[gtksourceview] SearchContext: do not emit the highlight-updated signal



commit 3f0fe75f6b47a881022c9f9f3c2d98fde86b58a3
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Jan 21 22:27:40 2014 +0100

    SearchContext: do not emit the highlight-updated signal
    
    When the search was implemented in gedit, there was the
    search-highlight-updated signal, similar to the highlight-updated signal
    from GtkSourceBuffer. So when moving the search implementation in
    GtkSourceView, I reused the highlight-updated signal.
    
    I think the signal is no longer required for the search. I added a
    comment for the highlight-updated signal for explaining when this signal
    is useful (and currently used in the spell gedit plugin).
    
    Moreover, the search didn't send the signal at the right time. When
    g_signal_emit_by_name() was called, the start and end variables could be
    the entire buffer, resulting in performances problems when the spell
    gedit plugin was enabled with the Highlight Misspelled Words option
    (because the plugin connects to the signal, and rescan the specified
    region).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722535

 gtksourceview/gtksourcebuffer.c        |    7 ++++---
 gtksourceview/gtksourcesearchcontext.c |    8 --------
 2 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index 85743e4..a23c060 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -386,9 +386,10 @@ gtk_source_buffer_class_init (GtkSourceBufferClass *klass)
         * @start: the start of the updated region
         * @end: the end of the updated region
         *
-        * The ::highlight-updated signal is emitted when the highlighting is
-        * updated in a certain region of the @buffer. It can be the syntax
-        * highlighting, the search highlighting, etc.
+        * The ::highlight-updated signal is emitted when the syntax
+        * highlighting is updated in a certain region of the @buffer. This
+        * signal is useful to be notified when a context class region is
+        * updated (e.g. the no-spell-check context class).
         */
        buffer_signals[HIGHLIGHT_UPDATED] =
            g_signal_newv ("highlight_updated",
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index a6450f0..8ad7ca0 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -2298,14 +2298,6 @@ add_subregion_to_scan (GtkSourceSearchContext *search,
        });
 
        install_idle_scan (search);
-
-       /* The highlighting can be modified a bit backward and forward the
-        * region.
-        */
-       gtk_text_iter_backward_lines (&start, search->priv->text_nb_lines);
-       gtk_text_iter_forward_lines (&end, search->priv->text_nb_lines);
-
-       g_signal_emit_by_name (search->priv->buffer, "highlight-updated", &start, &end);
 }
 
 static void


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