diff options
author | Andreas Kling <kling@serenityos.org> | 2021-05-08 23:38:01 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-08 23:38:46 +0200 |
commit | fbe6c275c9329acd4e0135177e1427d667ef3fda (patch) | |
tree | f5ab1b03cae0a4a41720e3ff9f06972e9ca75518 /Userland/Libraries/LibGUI | |
parent | 194a90884cf54fd17a9de8b42faef62bd6b9d567 (diff) | |
download | serenity-fbe6c275c9329acd4e0135177e1427d667ef3fda.zip |
LibGUI: Clear GUI::TextEditor selection before performing undo/redo
Fixes #6972.
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/TextEditor.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/TextEditor.h | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 8a3b9f97e3..44aa98cef9 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -1820,4 +1820,16 @@ void TextEditor::set_ruler_visible(bool visible) update(); } +void TextEditor::undo() +{ + clear_selection(); + document().undo(); +} + +void TextEditor::redo() +{ + clear_selection(); + document().redo(); +} + } diff --git a/Userland/Libraries/LibGUI/TextEditor.h b/Userland/Libraries/LibGUI/TextEditor.h index 7a4d14eba3..6bf15f31f1 100644 --- a/Userland/Libraries/LibGUI/TextEditor.h +++ b/Userland/Libraries/LibGUI/TextEditor.h @@ -130,8 +130,8 @@ public: void do_delete(); void delete_current_line(); 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(bool modified)> on_modified_change; |