mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibGUI: Support applying AutocompleteBox suggestions with mouse
Fixes: #8004
This commit is contained in:
parent
9d2e169169
commit
221a32577e
Notes:
sideshowbarker
2024-07-18 00:48:26 +09:00
Author: https://github.com/guerinoni
Commit: 221a32577e
Pull-request: https://github.com/SerenityOS/serenity/pull/10901
Issue: https://github.com/SerenityOS/serenity/issues/8004
Reviewed-by: https://github.com/linusg
1 changed files with 7 additions and 0 deletions
|
@ -100,6 +100,13 @@ AutocompleteBox::AutocompleteBox(TextEditor& editor)
|
|||
m_suggestion_view = main_widget.add<GUI::TableView>();
|
||||
m_suggestion_view->set_column_headers_visible(false);
|
||||
m_suggestion_view->set_visible(false);
|
||||
m_suggestion_view->on_activation = [&](GUI::ModelIndex const& index) {
|
||||
if (!m_suggestion_view->model()->is_within_range(index))
|
||||
return;
|
||||
m_suggestion_view->selection().set(index);
|
||||
m_suggestion_view->scroll_into_view(index, Orientation::Vertical);
|
||||
apply_suggestion();
|
||||
};
|
||||
|
||||
m_no_suggestions_view = main_widget.add<GUI::Label>("No suggestions");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue