[Xfce4-commits] [apps/mousepad] 01/03: Start search at correct location when backwards

noreply at xfce.org noreply at xfce.org
Sat Jul 12 22:02:44 CEST 2014


This is an automated email from the git hooks/post-receive script.

mbrush pushed a commit to branch master
in repository apps/mousepad.

commit 0061a2168f820035c278f883bd056a2cee57ea4a
Author: Matthew Brush <mbrush at codebrainz.ca>
Date:   Sat Jul 12 12:00:24 2014 -0700

    Start search at correct location when backwards
    
    I'm still a little confused by this searching code but I think the
    search was starting in the wrong location. Also reformat some nearby
    code.
    
    Closes #10999 (https://bugzilla.xfce.org/show_bug.cgi?id=10999)
---
 mousepad/mousepad-util.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/mousepad/mousepad-util.c b/mousepad/mousepad-util.c
index 05ed8af..21a447c 100644
--- a/mousepad/mousepad-util.c
+++ b/mousepad/mousepad-util.c
@@ -822,6 +822,8 @@ mousepad_util_search_get_iters (GtkTextBuffer       *buffer,
       tmp = *start;
       *start = *end;
       *end = tmp;
+      /* when searching backwards, we need to start before the selection */
+      gtk_text_iter_backward_char (iter);
     }
 }
 
@@ -975,7 +977,7 @@ mousepad_util_search (GtkTextBuffer       *buffer,
               gtk_text_buffer_select_range (buffer, &match_start, &match_end);
             }
           else if (flags & MOUSEPAD_SEARCH_FLAGS_ACTION_REPLACE)
-          {
+            {
               /* create text mark */
               mark_replace = gtk_text_buffer_create_mark (buffer, NULL, &match_start, search_backwards);
 
@@ -1002,8 +1004,8 @@ mousepad_util_search (GtkTextBuffer       *buffer,
 
               /* search again */
               search_again = TRUE;
-          }
-        else if (flags & MOUSEPAD_SEARCH_FLAGS_ACTION_NONE)
+            }
+          else if (flags & MOUSEPAD_SEARCH_FLAGS_ACTION_NONE)
             {
               /* keep searching when requested */
               if (flags & MOUSEPAD_SEARCH_FLAGS_ENTIRE_AREA)
@@ -1012,8 +1014,8 @@ mousepad_util_search (GtkTextBuffer       *buffer,
               /* move iter */
               iter = match_end;
             }
-        else
-          {
+          else
+            {
               /* no valid action was defined */
               mousepad_assert_not_reached ();
             }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list