summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/AbstractView.h
diff options
context:
space:
mode:
authoriCristalrope <icristalrope@gmail.com>2021-04-21 17:09:04 +0200
committerGitHub <noreply@github.com>2021-04-21 17:09:04 +0200
commit8bb4409a5df3964e9c8fc058a1adc426d29d152e (patch)
treee587be443853143e6e17958d98c86b31c6f95c60 /Userland/Libraries/LibGUI/AbstractView.h
parentfd43ee09e189a0eaa8acb7af32a1b4d3fd54ca1c (diff)
downloadserenity-8bb4409a5df3964e9c8fc058a1adc426d29d152e.zip
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.
Diffstat (limited to 'Userland/Libraries/LibGUI/AbstractView.h')
-rw-r--r--Userland/Libraries/LibGUI/AbstractView.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/AbstractView.h b/Userland/Libraries/LibGUI/AbstractView.h
index 15018ab301..10cf80d086 100644
--- a/Userland/Libraries/LibGUI/AbstractView.h
+++ b/Userland/Libraries/LibGUI/AbstractView.h
@@ -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;