[gnote] Fix selection appearing back after removing and saving



commit 18bb7286217e63059297117823039cca02b05ae3
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Feb 20 18:49:20 2022 +0200

    Fix selection appearing back after removing and saving

 src/note.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/note.cpp b/src/note.cpp
index 5f7668b7..b42e5ae7 100644
--- a/src/note.cpp
+++ b/src/note.cpp
@@ -403,8 +403,13 @@ namespace gnote {
       m_data.data().set_cursor_position(start.get_offset());
       m_data.data().set_selection_bound_position(end.get_offset());
     }
-    else if(insert == insert_mark) {
-      m_data.data().set_cursor_position(iter.get_offset());
+    else {
+      auto cursor_pos = insert_mark->get_iter().get_offset();
+      if(m_data.data().cursor_position() == cursor_pos && m_data.data().selection_bound_position() == 
NoteData::s_noPosition) {
+        // no change, do not queue save
+        return;
+      }
+      m_data.data().set_cursor_position(cursor_pos);
       m_data.data().set_selection_bound_position(NoteData::s_noPosition);
     }
 


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