[gspell] inline-checker-text-buffer: fix bug with neighbor words



commit 29196c9e21088a555ebb10cdd8e7f2473400562f
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Feb 11 16:27:19 2016 +0100

    inline-checker-text-buffer: fix bug with neighbor words
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761403

 gspell/gspell-inline-checker-text-buffer.c  |   14 ++++++++++++++
 testsuite/test-inline-checker-text-buffer.c |    3 ---
 2 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/gspell/gspell-inline-checker-text-buffer.c b/gspell/gspell-inline-checker-text-buffer.c
index 37ceaa7..7eadb9c 100644
--- a/gspell/gspell-inline-checker-text-buffer.c
+++ b/gspell/gspell-inline-checker-text-buffer.c
@@ -413,6 +413,20 @@ insert_text_after_cb (GtkTextBuffer                 *buffer,
        start = end = *location;
        gtk_text_iter_backward_chars (&start, g_utf8_strlen (text, length));
 
+       /* Include neighbor words */
+
+       if (gtk_text_iter_ends_word (&start) ||
+           (gtk_text_iter_inside_word (&start) &&
+            !gtk_text_iter_starts_word (&start)))
+       {
+               gtk_text_iter_backward_word_start (&start);
+       }
+
+       if (gtk_text_iter_inside_word (&end))
+       {
+               gtk_text_iter_forward_word_end (&end);
+       }
+
        add_subregion_to_scan (spell, &start, &end);
        install_timeout (spell, TIMEOUT_DURATION_BUFFER_MODIFIED);
 }
diff --git a/testsuite/test-inline-checker-text-buffer.c b/testsuite/test-inline-checker-text-buffer.c
index 3fe57f8..d1e0da5 100644
--- a/testsuite/test-inline-checker-text-buffer.c
+++ b/testsuite/test-inline-checker-text-buffer.c
@@ -200,15 +200,12 @@ test_text_insertion (void)
        gtk_text_buffer_get_iter_at_offset (buffer, &iter, 4);
        gtk_text_buffer_insert (buffer, &iter, " ", -1);
 
-       /* FIXME */
-#if 0
        check_highlighted_words (buffer,
                                 inline_checker,
                                 11, 18,
                                 19, 25,
                                 27, 34,
                                 -1);
-#endif
 
        g_object_unref (inline_checker);
        g_object_unref (buffer);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]