commit 3b3041f530a981dd4815b02361fd6339f341978d
parent f087295acc05b85ff6aa6b4a5109ff4f309a2897
Author: Colin Leroy <colin@colino.net>
Date: Thu, 9 Jul 2009 06:41:35 +0000
2009-07-09 [colin] 3.7.2cvs4
* src/gtk/spell_entry.c
Fix bug 1949, 'Spell checker doesn't recognise
certain word in Subject header, but does in
message body'. Patch by Pawel Pekala.
Diffstat:
4 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-09 [colin] 3.7.2cvs4
+
+ * src/gtk/spell_entry.c
+ Fix bug 1949, 'Spell checker doesn't recognise
+ certain word in Subject header, but does in
+ message body'. Patch by Pawel Pekala.
+
2009-07-09 [paul] 3.7.2cvs3
* configure.ac
diff --git a/PATCHSETS b/PATCHSETS
@@ -3828,3 +3828,4 @@
( cvs diff -u -r 1.1.2.20 -r 1.1.2.21 tools/claws.i18n.status.pl; ) > 3.7.2cvs1.patchset
( cvs diff -u -r 1.16.2.37 -r 1.16.2.38 src/prefs_customheader.c; ) > 3.7.2cvs2.patchset
( cvs diff -u -r 1.654.2.3896 -r 1.654.2.3897 configure.ac; ) > 3.7.2cvs3.patchset
+( cvs diff -u -r 1.1.2.7 -r 1.1.2.8 src/gtk/spell_entry.c; ) > 3.7.2cvs4.patchset
diff --git a/configure.ac b/configure.ac
@@ -12,7 +12,7 @@ MINOR_VERSION=7
MICRO_VERSION=2
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=3
+EXTRA_VERSION=4
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/gtk/spell_entry.c b/src/gtk/spell_entry.c
@@ -257,6 +257,29 @@ static gboolean word_misspelled(ClawsSpellEntry *entry, int start, int end)
return ret;
}
+static gboolean is_word_end (GtkEntry *entry, const int offset)
+{
+ gchar *p = gtk_editable_get_chars(GTK_EDITABLE(entry), offset, offset+1);
+ gunichar ch;
+
+ ch = g_utf8_get_char(p);
+ g_free(p);
+
+ if (ch == '\0')
+ return TRUE;
+
+ if (ch == '\'') {
+ p = gtk_editable_get_chars(GTK_EDITABLE(entry), offset+1, offset+2);
+ ch = g_utf8_get_char(p);
+ g_free(p);
+
+ return (g_unichar_isspace(ch) || g_unichar_ispunct(ch)
+ || g_unichar_isdigit(ch));
+ }
+
+ return (g_unichar_isspace(ch) || g_unichar_ispunct(ch));
+}
+
static void entry_strsplit_utf8(GtkEntry *entry, gchar ***set, gint **starts, gint **ends)
{
PangoLayout *layout;
@@ -286,7 +309,7 @@ static void entry_strsplit_utf8(GtkEntry *entry, gchar ***set, gint **starts, gi
/* Find the end of this string */
cend = i;
- while (!(log_attrs[cend].is_word_end))
+ while (!is_word_end(entry, cend))
cend++;
/* Copy sub-string */