Ver código fonte

LibGUI: Clear GUI::TextEditor selection before performing undo/redo

Fixes #6972.
Andreas Kling 4 anos atrás
pai
commit
fbe6c275c9

+ 12 - 0
Userland/Libraries/LibGUI/TextEditor.cpp

@@ -1820,4 +1820,16 @@ void TextEditor::set_ruler_visible(bool visible)
     update();
     update();
 }
 }
 
 
+void TextEditor::undo()
+{
+    clear_selection();
+    document().undo();
+}
+
+void TextEditor::redo()
+{
+    clear_selection();
+    document().redo();
+}
+
 }
 }

+ 2 - 2
Userland/Libraries/LibGUI/TextEditor.h

@@ -130,8 +130,8 @@ public:
     void do_delete();
     void do_delete();
     void delete_current_line();
     void delete_current_line();
     void select_all();
     void select_all();
-    virtual void undo() { document().undo(); }
-    virtual void redo() { document().redo(); }
+    virtual void undo();
+    virtual void redo();
 
 
     Function<void()> on_change;
     Function<void()> on_change;
     Function<void(bool modified)> on_modified_change;
     Function<void(bool modified)> on_modified_change;