[gnote/stable-0.6] Correct the behaviour of the Find Previous and Next features



commit 4c2a07257d481b658466328ee14fe564883f9a57
Author: Iain Nicol <iain thenicols net>
Date:   Sat Oct 10 23:10:58 2009 +0100

    Correct the behaviour of the Find Previous and Next features
    
    Fixes: https://bugzilla.gnome.org/598045
    
    Signed-off-by: Debarshi Ray <debarshir src gnome org>
    (cherry picked from commit 7e197caf07535a702a409d34150d52248b8184a2)

 src/notewindow.cpp |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 601383d..d45c5b2 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -721,10 +721,11 @@ namespace gnote {
       Match & match(*iter);
       
       Glib::RefPtr<NoteBuffer> buffer = match.buffer;
-      Gtk::TextIter cursor = buffer->get_iter_at_mark(buffer->get_insert());
+      Gtk::TextIter selection_start, selection_end;
+      buffer->get_selection_bounds(selection_start, selection_end);
       Gtk::TextIter end = buffer->get_iter_at_mark(match.start_mark);
 
-      if (end.get_offset() < cursor.get_offset()) {
+      if (end.get_offset() < selection_start.get_offset()) {
         jump_to_match(match);
         return;
       }
@@ -744,10 +745,11 @@ namespace gnote {
       Match & match(*iter);
 
       Glib::RefPtr<NoteBuffer> buffer = match.buffer;
-      Gtk::TextIter cursor = buffer->get_iter_at_mark(buffer->get_insert());
+      Gtk::TextIter selection_start, selection_end;
+      buffer->get_selection_bounds(selection_start, selection_end);
       Gtk::TextIter start = buffer->get_iter_at_mark(match.start_mark);
 
-      if (start.get_offset() >= cursor.get_offset()) {
+      if (start.get_offset() >= selection_end.get_offset()) {
         jump_to_match(match);
         return;
       }



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