Skip to content

Commit 7a4b912

Browse files
iyushawesomekling
authored andcommitted
LibGUI: Fix invalid ModelIndices during shift-click multiselection
Previously, If the widget was unfocused, the selection start index would be invalid. This would result in invalid selections when doing shift+click on the widget (while it is unfocused). Now, we reassign the selection start index to current index before we initiate multiselection, if selection start index is invalid. Should Fix #11999 and the same bug inside FileManager.
1 parent 5f67d00 commit 7a4b912

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Userland/Libraries/LibGUI/AbstractView.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ void AbstractView::set_cursor(ModelIndex index, SelectionUpdate selection_update
493493
if (!m_selection.contains(index))
494494
clear_selection();
495495
} else if (selection_update == SelectionUpdate::Shift) {
496+
if (!selection_start_index().is_valid())
497+
set_selection_start_index(index);
496498
select_range(index);
497499
}
498500

0 commit comments

Comments
 (0)