diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2022-11-17 10:40:52 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-11-19 16:04:42 +0100 |
commit | 901878bad966a64d098e35ec29cbd2a66cfab0f2 (patch) | |
tree | d05b316927bccd9b455398b89bc55d0ba13f7f26 /Userland/Libraries/LibGUI | |
parent | 2c5890293996d6e369961be8c0419d1d6eec2f6b (diff) | |
download | serenity-901878bad966a64d098e35ec29cbd2a66cfab0f2.zip |
LibGUI: Use move_cursor() API for AutocompleteProvider
Fixes failure to update focus rect when moving between items.
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/AutocompleteProvider.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp index 93136aaca2..0be4c90c5f 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp @@ -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() |