summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibGUI/AutocompleteProvider.cpp22
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()