[gnote/gnome-3-38] Fix find previous match
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote/gnome-3-38] Fix find previous match
- Date: Sun, 10 Jan 2021 15:21:13 +0000 (UTC)
commit 412f0c50757e6a0db7c9afb17249c728318d7a3b
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Nov 29 20:52:18 2020 +0200
Fix find previous match
src/notewindow.cpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 6c3db72f..327c3690 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -631,6 +631,7 @@ namespace gnote {
if (m_current_matches.empty() || m_current_matches.size() == 0)
return false;
+ Match *previous_match = nullptr;
for (auto & match : m_current_matches) {
Glib::RefPtr<NoteBuffer> buffer = match.buffer;
Gtk::TextIter selection_start, selection_end;
@@ -638,9 +639,15 @@ namespace gnote {
Gtk::TextIter end = buffer->get_iter_at_mark(match.start_mark);
if (end.get_offset() < selection_start.get_offset()) {
- jump_to_match(match);
- return true;
+ previous_match = &match;
}
+ else {
+ break;
+ }
+ }
+ if(previous_match) {
+ jump_to_match(*previous_match);
+ return true;
}
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]