mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-05 01:55:21 +03: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: https://github.com/SerenityOS/serenity/commit/221a32577e5 Pull-request: https://github.com/SerenityOS/serenity/pull/10901 Issue: https://github.com/SerenityOS/serenity/issues/8004 Reviewed-by: https://github.com/linusg
@ -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…
Reference in New Issue
Block a user