mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
LibGUI: Default-initialize cursor when focusing an AbstractView
If an AbstractView receives focus without a valid cursor index, we now ask it to move its cursor to the home position. This way, the user can actually start moving the cursor after tabbing to a view.
This commit is contained in:
@@ -678,4 +678,12 @@ void AbstractView::draw_item_text(Gfx::Painter& painter, const ModelIndex& index
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractView::focusin_event(FocusEvent& event)
|
||||
{
|
||||
ScrollableWidget::focusin_event(event);
|
||||
|
||||
if (model() && !cursor_index().is_valid())
|
||||
move_cursor(CursorMovement::Home, SelectionUpdate::None);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user