After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 97861 - spell checking breaks on contractions
spell checking breaks on contractions
Status: RESOLVED DUPLICATE of bug 97545
Product: gedit-plugins
Classification: Other
Component: General
git master
Other other
: Normal normal
: ---
Assigned To: Gedit maintainers
gedit QA volunteers
Depends on:
Blocks:
 
 
Reported: 2002-11-06 16:38 UTC by Luis Villa
Modified: 2019-03-23 20:34 UTC
See Also:
GNOME target: ---
GNOME version: 2.1/2.2



Description Luis Villa 2002-11-06 16:38:31 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.
Comment 1 Paolo Maggi 2002-11-23 09:52:17 UTC
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).
Comment 2 compwiz 2002-12-09 06:40:16 UTC
gtkspell 2.0.3 has worked around this problem and should work fine
with contractions.
Comment 3 Paolo Maggi 2002-12-09 09:01:11 UTC
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 ***
Comment 4 Evan Martin 2003-01-18 00:42:46 UTC
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.