mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09: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
Notes:
sideshowbarker
2024-07-17 08:21:54 +09:00
Author: https://github.com/matthewbjones
Commit: 79a5a1c209
Pull-request: https://github.com/SerenityOS/serenity/pull/14797
Issue: https://github.com/SerenityOS/serenity/issues/10521
Reviewed-by: https://github.com/bgianfo ✅
1 changed files with 1 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue