GNOME Bugzilla – Bug 97861
spell checking breaks on contractions
Last modified: 2019-03-23 20:34:47 UTC
I'm not sure if this is a gnomespell or a gedit problem, but it registers all contractions as broken words- the spell checker apparently gets only "doesn" instead of "doesn't" and so of course it reports 'doesn' as a bogus word.
It is a gedit problem (gedit does not use gnome-spell). Actually it could be a Pango problem since gedit uses pango to find word breaks, but I'm not sure (note that also gtk-spell has the same problem).
gtkspell 2.0.3 has worked around this problem and should work fine with contractions.
I have not read the gtkspell 2.0.3 code, but according to the release notes, they fixed the problem with an hack: > - Hack around Pango word-breaking bug: > http://bugzilla.gnome.org/show_bug.cgi?id=97545 > so we no longer incorrectly flag words with apostrophes as > misspellings. BTW, your comment helped me since I discovered that this bug is a duplicate of bug #97545 *** This bug has been marked as a duplicate of 97545 ***
This, at the top of gedit-automatic-spell-checker.c, should do it: static gboolean gtkspell_text_iter_forward_word_end(GtkTextIter *i) { GtkTextIter iter; /* heuristic: * if we're on an singlequote/apostrophe and * if the next letter is alphanumeric, * this is an apostrophe. */ if (!gtk_text_iter_forward_word_end(i)) return FALSE; if (gtk_text_iter_get_char(i) != '\'') return TRUE; iter = *i; if (gtk_text_iter_forward_char(&iter)) { if (g_unichar_isalpha(gtk_text_iter_get_char(&iter))) { return (gtk_text_iter_forward_word_end(i)); } } return TRUE; } static gboolean gtkspell_text_iter_backward_word_start(GtkTextIter *i) { GtkTextIter iter; if (!gtk_text_iter_backward_word_start(i)) return FALSE; iter = *i; if (gtk_text_iter_backward_char(&iter)) { if (gtk_text_iter_get_char(&iter) == '\'') { if (gtk_text_iter_backward_char(&iter)) { if (g_unichar_isalpha(gtk_text_iter_get_char(&iter))) { return (gtk_text_iter_backward_word_start(i)); } } } } return TRUE; } #define gtk_text_iter_backward_word_start gtkspell_text_iter_backward_word_start #define gtk_text_iter_forward_word_end gtkspell_text_iter_forward_word_end It is a hack, but not that bad as far as hacks go.