summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibGUI/AutocompleteProvider.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
index 280d19aefc..58ffcea628 100644
--- a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
+++ b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
@@ -112,12 +112,13 @@ void AutocompleteBox::update_suggestions(Vector<AutocompleteProvider::Entry>&& s
model.set_suggestions(move(suggestions));
} else {
m_suggestion_view->set_model(adopt_ref(*new AutocompleteSuggestionModel(move(suggestions))));
- if (has_suggestions)
- m_suggestion_view->set_cursor(m_suggestion_view->model()->index(0), GUI::AbstractView::SelectionUpdate::Set);
}
m_suggestion_view->model()->invalidate();
+ if (has_suggestions)
+ m_suggestion_view->set_cursor(m_suggestion_view->model()->index(0), GUI::AbstractView::SelectionUpdate::Set);
+
m_suggestion_view->set_visible(has_suggestions);
m_no_suggestions_view->set_visible(!has_suggestions);
m_popup_window->resize(has_suggestions ? Gfx::IntSize(300, 100) : Gfx::IntSize(175, 25));
@@ -136,8 +137,6 @@ void AutocompleteBox::show(Gfx::IntPoint suggestion_box_location)
return;
m_popup_window->move_to(suggestion_box_location);
- if (!is_visible())
- m_suggestion_view->move_cursor(GUI::AbstractView::CursorMovement::Home, GUI::AbstractTableView::SelectionUpdate::Set);
m_popup_window->show();
}