mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-03 22:54:55 +00:00
LibGUI: Correct cursor index during mouseup_event
Previously, during a m_might_drag mouse_up event, we were updating the selection directly, which caused the selection to be accurate but the location of the cursor index to be stale/incorrect. The side effect of this is then future events may point to the wrong index. Instead, call the set_cursor function with SelectionUpdate::Set, which handles both updating the cursor index as well as the selection index.
This commit is contained in:
parent
ff6f56ef7a
commit
79a5a1c209
|
@ -359,8 +359,7 @@ void AbstractView::mouseup_event(MouseEvent& event)
|
|||
// Since we're here, it was not that; so fix up the selection now.
|
||||
auto index = index_at_event_position(event.position());
|
||||
if (index.is_valid()) {
|
||||
set_selection(index);
|
||||
set_selection_start_index(index);
|
||||
set_cursor(index, SelectionUpdate::Set, true);
|
||||
} else
|
||||
clear_selection();
|
||||
m_might_drag = false;
|
||||
|
|
Loading…
Reference in a new issue