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

LibGUI: Track selection starting index in AbstractView (#6515)

Modifying the selection while holding the shift button and selecting
with the mouse or the arrow keys no longer results in broken selections.

Fixes #6279.
This commit is contained in:
iCristalrope 2021-04-21 17:09:04 +02:00 committed by GitHub
parent fd43ee09e1
commit 8bb4409a5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 13 deletions

View file

@ -136,6 +136,7 @@ public:
virtual void scroll_into_view(const ModelIndex&, [[maybe_unused]] bool scroll_horizontally = true, [[maybe_unused]] bool scroll_vertically = true) { }
const ModelIndex& cursor_index() const { return m_cursor_index; }
const ModelIndex& selection_start_index() const { return m_selection_start_index; }
void set_cursor(ModelIndex, SelectionUpdate, bool scroll_cursor_into_view = true);
bool is_tab_key_navigation_enabled() const { return m_tab_key_navigation_enabled; }
@ -163,6 +164,7 @@ protected:
virtual void clear_selection();
virtual void set_selection(const ModelIndex&);
virtual void set_selection_start_index(const ModelIndex&);
virtual void add_selection(const ModelIndex&);
virtual void remove_selection(const ModelIndex&);
virtual void toggle_selection(const ModelIndex&);
@ -206,6 +208,7 @@ protected:
private:
RefPtr<Model> m_model;
ModelSelection m_selection;
ModelIndex m_selection_start_index;
String m_searching;
RefPtr<Core::Timer> m_searching_timer;
ModelIndex m_cursor_index;