mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00: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
1 changed files with 2 additions and 20 deletions
|
@ -160,30 +160,12 @@ void AutocompleteBox::close()
|
||||||
|
|
||||||
void AutocompleteBox::next_suggestion()
|
void AutocompleteBox::next_suggestion()
|
||||||
{
|
{
|
||||||
GUI::ModelIndex new_index = m_suggestion_view->selection().first();
|
m_suggestion_view->move_cursor(GUI::AbstractView::CursorMovement::Down, GUI::AbstractView::SelectionUpdate::Set);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutocompleteBox::previous_suggestion()
|
void AutocompleteBox::previous_suggestion()
|
||||||
{
|
{
|
||||||
GUI::ModelIndex new_index = m_suggestion_view->selection().first();
|
m_suggestion_view->move_cursor(GUI::AbstractView::CursorMovement::Up, GUI::AbstractView::SelectionUpdate::Set);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying AutocompleteBox::apply_suggestion()
|
CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying AutocompleteBox::apply_suggestion()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue