mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 01:08:48 +00:00
LibGUI: Enforce the SelectionMode in AbstractView::set_cursor()
This commit is contained in:
parent
66c0374fd7
commit
f06b240ce0
Notes:
sideshowbarker
2024-07-19 00:28:46 +09:00
Author: https://github.com/awesomekling
Commit: f06b240ce0
1 changed files with 4 additions and 1 deletions
|
@ -433,7 +433,7 @@ void AbstractView::set_key_column_and_sort_order(int column, SortOrder sort_orde
|
|||
|
||||
void AbstractView::set_cursor(ModelIndex index, SelectionUpdate selection_update, bool scroll_cursor_into_view)
|
||||
{
|
||||
if (!model() || !index.is_valid()) {
|
||||
if (!model() || !index.is_valid() || selection_mode() == SelectionMode::NoSelection) {
|
||||
m_cursor_index = {};
|
||||
cancel_searching();
|
||||
return;
|
||||
|
@ -442,6 +442,9 @@ void AbstractView::set_cursor(ModelIndex index, SelectionUpdate selection_update
|
|||
if (!m_cursor_index.is_valid() || model()->parent_index(m_cursor_index) != model()->parent_index(index))
|
||||
cancel_searching();
|
||||
|
||||
if (selection_mode() == SelectionMode::SingleSelection && (selection_update == SelectionUpdate::Ctrl || selection_update == SelectionUpdate::Shift))
|
||||
selection_update = SelectionUpdate::Set;
|
||||
|
||||
if (model()->is_valid(index)) {
|
||||
if (selection_update == SelectionUpdate::Set)
|
||||
set_selection(index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue