mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 05:35:52 +03:00
LibGUI: Use move_cursor() API for AutocompleteProvider
Fixes failure to update focus rect when moving between items.
This commit is contained in:
parent
2c58902939
commit
901878bad9
Notes:
sideshowbarker
2024-07-17 04:19:09 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/901878bad9 Pull-request: https://github.com/SerenityOS/serenity/pull/16098
@ -160,30 +160,12 @@ void AutocompleteBox::close()
|
||||
|
||||
void AutocompleteBox::next_suggestion()
|
||||
{
|
||||
GUI::ModelIndex new_index = m_suggestion_view->selection().first();
|
||||
if (new_index.is_valid())
|
||||
new_index = m_suggestion_view->model()->index(new_index.row() + 1);
|
||||
else
|
||||
new_index = m_suggestion_view->model()->index(0);
|
||||
|
||||
if (m_suggestion_view->model()->is_within_range(new_index)) {
|
||||
m_suggestion_view->selection().set(new_index);
|
||||
m_suggestion_view->scroll_into_view(new_index, Orientation::Vertical);
|
||||
}
|
||||
m_suggestion_view->move_cursor(GUI::AbstractView::CursorMovement::Down, GUI::AbstractView::SelectionUpdate::Set);
|
||||
}
|
||||
|
||||
void AutocompleteBox::previous_suggestion()
|
||||
{
|
||||
GUI::ModelIndex new_index = m_suggestion_view->selection().first();
|
||||
if (new_index.is_valid())
|
||||
new_index = m_suggestion_view->model()->index(new_index.row() - 1);
|
||||
else
|
||||
new_index = m_suggestion_view->model()->index(0);
|
||||
|
||||
if (m_suggestion_view->model()->is_within_range(new_index)) {
|
||||
m_suggestion_view->selection().set(new_index);
|
||||
m_suggestion_view->scroll_into_view(new_index, Orientation::Vertical);
|
||||
}
|
||||
m_suggestion_view->move_cursor(GUI::AbstractView::CursorMovement::Up, GUI::AbstractView::SelectionUpdate::Set);
|
||||
}
|
||||
|
||||
CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying AutocompleteBox::apply_suggestion()
|
||||
|
Loading…
Reference in New Issue
Block a user