1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:27:45 +00:00

EditingEngine: Split selection from movement functions

This patch moves selection updates outside movement functions in
EditingEngine.  Previously, movement functions would automatically
update the selection based on whether the Shift key was pressed down
during movement.  However, not all EditingEngine subclasses want that;
VimEditingEngine being a good example (because all selection is handled
in visual mode).

Therefore, this patch moves all selection updating to
EditingEngine::on_key().  Subclasses wishing to provide custom movement
and selection semantics should override it (and VimEditingEngine already
does).
This commit is contained in:
sin-ack 2021-04-26 20:29:05 +00:00 committed by Andreas Kling
parent 4e6a26cbd2
commit d6dc81874d
6 changed files with 72 additions and 68 deletions

View file

@ -166,7 +166,7 @@ private:
String m_yank_buffer {};
void yank(YankType);
void yank(TextRange);
void put(const GUI::KeyEvent&);
void put();
void update_selection_on_cursor_move();
void clear_visual_mode_data();
@ -175,8 +175,8 @@ private:
void switch_to_normal_mode();
void switch_to_insert_mode();
void switch_to_visual_mode();
void move_half_page_up(const KeyEvent& event);
void move_half_page_down(const KeyEvent& event);
void move_half_page_up();
void move_half_page_down();
void move_to_previous_empty_lines_block();
void move_to_next_empty_lines_block();