commit e9de6108a7e1bc7d7c0a306af6d1421b0a18277d
parent b1a7cd1f82ee41f96fa35a49517bcf3cf9a90ee4
Author: Colin Leroy <colin@colino.net>
Date: Tue, 1 Nov 2011 20:29:31 +0000
2011-11-01 [colin] 3.7.10cvs67
* src/compose.c
* src/main.c
* src/common/utils.c
* src/gtk/gtkaspell.c
* src/gtk/gtkaspell.h
Fix huge slowness induced by spellcheck "while typing"
during initial quote rewraps.
Diffstat:
8 files changed, 52 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,13 @@
+2011-11-01 [colin] 3.7.10cvs67
+
+ * src/compose.c
+ * src/main.c
+ * src/common/utils.c
+ * src/gtk/gtkaspell.c
+ * src/gtk/gtkaspell.h
+ Fix huge slowness induced by spellcheck "while typing"
+ during initial quote rewraps.
+
2011-10-31 [pawel] 3.7.10cvs66
* src/messageview.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -4270,3 +4270,4 @@
( cvs diff -u -r 1.395.2.434 -r 1.395.2.435 src/summaryview.c; cvs diff -u -r 1.5.2.100 -r 1.5.2.101 src/gtk/gtkutils.c; ) > 3.7.10cvs64.patchset
( cvs diff -u -r 1.9.2.52 -r 1.9.2.53 src/common/defs.h; ) > 3.7.10cvs65.patchset
( cvs diff -u -r 1.94.2.221 -r 1.94.2.222 src/messageview.c; cvs diff -u -r 1.83.2.176 -r 1.83.2.177 src/mimeview.c; cvs diff -u -r 1.20.2.33 -r 1.20.2.34 src/mimeview.h; cvs diff -u -r 1.395.2.435 -r 1.395.2.436 src/summaryview.c; ) > 3.7.10cvs66.patchset
+( cvs diff -u -r 1.382.2.591 -r 1.382.2.592 src/compose.c; cvs diff -u -r 1.115.2.243 -r 1.115.2.244 src/main.c; cvs diff -u -r 1.36.2.193 -r 1.36.2.194 src/common/utils.c; cvs diff -u -r 1.9.2.73 -r 1.9.2.74 src/gtk/gtkaspell.c; cvs diff -u -r 1.5.2.18 -r 1.5.2.19 src/gtk/gtkaspell.h; ) > 3.7.10cvs67.patchset
diff --git a/configure.ac b/configure.ac
@@ -12,7 +12,7 @@ MINOR_VERSION=7
MICRO_VERSION=10
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=66
+EXTRA_VERSION=67
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/common/utils.c b/src/common/utils.c
@@ -1143,6 +1143,7 @@ gint get_quote_level(const gchar *str, const gchar *quote_chars)
const gchar *p = str;
gint quote_level = -1;
+ return 1;
/* speed up line processing by only searching to the last '>' */
if ((first_pos = line_has_quote_char(str, quote_chars)) != NULL) {
/* skip a line if it contains a '<' before the initial '>' */
diff --git a/src/compose.c b/src/compose.c
@@ -1584,7 +1584,8 @@ static Compose *compose_generic_reply(MsgInfo *msginfo,
undo_block(compose->undostruct);
#ifdef USE_ENCHANT
- compose_set_dictionaries_from_folder_prefs(compose, msginfo->folder);
+ compose_set_dictionaries_from_folder_prefs(compose, msginfo->folder);
+ gtkaspell_block_check(compose->gtkaspell);
#endif
if (quote_mode == COMPOSE_QUOTE_FORCED ||
@@ -1620,10 +1621,6 @@ static Compose *compose_generic_reply(MsgInfo *msginfo,
_("The body of the \"Reply\" template has an error at line %d."));
compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
quote_fmt_reset_vartable();
-#ifdef USE_ENCHANT
- if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
- gtkaspell_highlight_all(compose->gtkaspell);
-#endif
}
if (MSG_IS_ENCRYPTED(compose->replyinfo->flags)) {
@@ -1643,6 +1640,11 @@ static Compose *compose_generic_reply(MsgInfo *msginfo,
compose_wrap_all(compose);
+#ifdef USE_ENCHANT
+ if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
+ gtkaspell_highlight_all(compose->gtkaspell);
+ gtkaspell_unblock_check(compose->gtkaspell);
+#endif
SIGNAL_UNBLOCK(textbuf);
gtk_widget_grab_focus(compose->text);
@@ -1741,6 +1743,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
pref_get_unescaped_pref(tmp, msginfo->folder->prefs->forward_override_from_format);
#ifdef USE_ENCHANT
+ gtkaspell_block_check(compose->gtkaspell);
quote_fmt_init(full_msginfo, NULL, NULL, FALSE, compose->account, FALSE,
compose->gtkaspell);
#else
@@ -1822,10 +1825,6 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
compose_attach_parts(compose, msginfo);
procmsg_msginfo_free(full_msginfo);
-#ifdef USE_ENCHANT
- if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
- gtkaspell_highlight_all(compose->gtkaspell);
-#endif
}
SIGNAL_BLOCK(textbuf);
@@ -1835,6 +1834,11 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
compose_wrap_all(compose);
+#ifdef USE_ENCHANT
+ if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
+ gtkaspell_highlight_all(compose->gtkaspell);
+ gtkaspell_unblock_check(compose->gtkaspell);
+#endif
SIGNAL_UNBLOCK(textbuf);
cursor_pos = quote_fmt_get_cursor_pos();
@@ -4555,7 +4559,7 @@ end:
*par_iter = iter;
undo_wrapping(compose->undostruct, FALSE);
compose->autowrap = prev_autowrap;
-
+
return modified;
}
diff --git a/src/gtk/gtkaspell.c b/src/gtk/gtkaspell.c
@@ -1188,6 +1188,28 @@ static void replace_word_cb(GtkWidget *w, gpointer data)
set_point_continue(gtkaspell);
}
+void gtkaspell_block_check(GtkAspell *gtkaspell)
+{
+ GtkTextView *gtktext = gtkaspell->gtktext;
+ g_signal_handlers_block_by_func(G_OBJECT(gtktext),
+ G_CALLBACK(entry_insert_cb),
+ gtkaspell);
+ g_signal_handlers_block_by_func(G_OBJECT(gtktext),
+ G_CALLBACK(entry_delete_cb),
+ gtkaspell);
+}
+
+void gtkaspell_unblock_check(GtkAspell *gtkaspell)
+{
+ GtkTextView *gtktext = gtkaspell->gtktext;
+ g_signal_handlers_unblock_by_func(G_OBJECT(gtktext),
+ G_CALLBACK(entry_insert_cb),
+ gtkaspell);
+ g_signal_handlers_unblock_by_func(G_OBJECT(gtktext),
+ G_CALLBACK(entry_delete_cb),
+ gtkaspell);
+}
+
static void replace_real_word(GtkAspell *gtkaspell, const gchar *newword)
{
int oldlen, newlen, wordlen;
diff --git a/src/gtk/gtkaspell.h b/src/gtk/gtkaspell.h
@@ -169,6 +169,8 @@ int gtkaspell_misspelled_test (GtkAspell *gtkaspell,
void gtkaspell_dict_changed (GtkAspell *gtkaspell);
void gtkaspell_context_set (GtkAspell *gtkaspell);
void gtkaspell_free_suggestions_list (GtkAspell *gtkaspell);
+void gtkaspell_block_check (GtkAspell *gtkaspell);
+void gtkaspell_unblock_check (GtkAspell *gtkaspell);
#endif /* USE_ENCHANT */
diff --git a/src/main.c b/src/main.c
@@ -2552,7 +2552,7 @@ static void lock_socket_input_cb(gpointer data,
debug_print("Unknown folder: '%s'\n",folder_name);
} else {
debug_print("%s %s\n",folderItem->name, folderItem->path);
- }
+ }
if (folderItem != NULL) {
quicksearch_set(quicksearch, searchType, request);
quicksearch_set_recursive(quicksearch, recursive);