[gtksourceview/wip/search] search: minor fixes



commit 9e6f2fea20819157edd3982aac158d8d9eea0b78
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Jun 19 11:49:36 2013 +0200

    search: minor fixes

 gtksourceview/gtksourcesearch.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/gtksourceview/gtksourcesearch.c b/gtksourceview/gtksourcesearch.c
index 2b761b2..5fb4ef8 100644
--- a/gtksourceview/gtksourcesearch.c
+++ b/gtksourceview/gtksourcesearch.c
@@ -141,8 +141,6 @@ update (GtkSourceSearch *search)
        GtkTextIter start;
        GtkTextIter end;
 
-       g_return_if_fail (GTK_SOURCE_IS_SEARCH (search));
-
        if (dispose_has_run (search))
        {
                return;
@@ -351,18 +349,16 @@ highlight_subregion (GtkSourceSearch *search,
 
        iter = *start;
 
+       if (gtk_text_iter_is_end (end))
+       {
+               end = NULL;
+       }
+
        do
        {
                GtkTextIter match_start;
                GtkTextIter match_end;
 
-               /* FIXME normally it is not needed.
-               if ((end != NULL) && gtk_text_iter_is_end (end))
-               {
-                       end = NULL;
-               }
-               */
-
                found = gtk_text_iter_forward_search (&iter,
                                                      search->priv->text,
                                                      search->priv->flags,
@@ -370,8 +366,6 @@ highlight_subregion (GtkSourceSearch *search,
                                                      &match_end,
                                                      end);
 
-               iter = match_end;
-
                if (found)
                {
                        gtk_text_buffer_apply_tag (search->priv->buffer,
@@ -380,6 +374,8 @@ highlight_subregion (GtkSourceSearch *search,
                                                   &match_end);
                }
 
+               iter = match_end;
+
        } while (found);
 }
 
@@ -431,4 +427,6 @@ _gtk_source_search_update_highlight (GtkSourceSearch   *search,
 
        /* Remove the just highlighted region */
        gtk_text_region_subtract (search->priv->region, start, end);
+
+       gtk_text_region_destroy (region_to_highlight, TRUE);
 }


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