diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2021-10-12 20:40:38 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-15 10:38:57 +0200 |
commit | 3647001c931240d57066ac4837e52011b8f35a1b (patch) | |
tree | 3ee6e009e867d4b27caae174c2ba6dbc4d1b5471 /Userland | |
parent | 68884eefc625abc433969b825160b76a26d2390f (diff) | |
download | serenity-3647001c931240d57066ac4837e52011b8f35a1b.zip |
LibGUI: Don't update selection twice after Ctrl-Right
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGUI/EditingEngine.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/EditingEngine.h | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/Userland/Libraries/LibGUI/EditingEngine.cpp b/Userland/Libraries/LibGUI/EditingEngine.cpp index b43721dca2..9a4526f441 100644 --- a/Userland/Libraries/LibGUI/EditingEngine.cpp +++ b/Userland/Libraries/LibGUI/EditingEngine.cpp @@ -79,7 +79,7 @@ bool EditingEngine::on_key(const KeyEvent& event) } if (event.ctrl()) { m_editor->update_selection(event.shift()); - move_to_next_span(event); + move_to_next_span(); if (event.shift() && m_editor->selection().start().is_valid()) { m_editor->selection().set_end(m_editor->cursor()); m_editor->did_update_selection(); @@ -217,7 +217,7 @@ void EditingEngine::move_to_previous_span() m_editor->set_cursor(new_cursor); } -void EditingEngine::move_to_next_span(const KeyEvent& event) +void EditingEngine::move_to_next_span() { TextPosition new_cursor; if (m_editor->document().has_spans()) { @@ -232,10 +232,6 @@ void EditingEngine::move_to_next_span(const KeyEvent& event) new_cursor = m_editor->document().first_word_break_after(m_editor->cursor()); } m_editor->set_cursor(new_cursor); - if (event.shift() && m_editor->selection().start().is_valid()) { - m_editor->selection().set_end(m_editor->cursor()); - m_editor->did_update_selection(); - } } void EditingEngine::move_to_logical_line_beginning() diff --git a/Userland/Libraries/LibGUI/EditingEngine.h b/Userland/Libraries/LibGUI/EditingEngine.h index f3cc449224..0885ae8805 100644 --- a/Userland/Libraries/LibGUI/EditingEngine.h +++ b/Userland/Libraries/LibGUI/EditingEngine.h @@ -47,7 +47,7 @@ protected: void move_one_up(const KeyEvent& event); void move_one_down(const KeyEvent& event); void move_to_previous_span(); - void move_to_next_span(const KeyEvent& event); + void move_to_next_span(); void move_to_logical_line_beginning(); void move_to_logical_line_end(); void move_to_line_beginning(); |