mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWebView: Add a "Search with <engine>" autocomplete row
Synthesize an extra AutocompleteSuggestion at the top of the Search Suggestions section whenever there is a configured search engine and the typed query is not URL-shaped. Use the query as the row's primary text, carry a "Search with <engine>" subtitle, and render that subtitle in the AppKit and Qt popups so the explicit search fallback stays visible and readable even when history fills the list.
This commit is contained in:
committed by
Andreas Kling
parent
bb9f789eae
commit
586da4e610
Notes:
github-actions[bot]
2026-04-16 19:02:36 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/586da4e6106 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8933 Reviewed-by: https://github.com/trflynn89
@@ -696,6 +696,7 @@ static NSImage* literal_url_suggestion_icon()
|
||||
auto const& suggestion = m_suggestions[row_model.suggestion_index];
|
||||
auto* suggestion_text = Ladybird::string_to_ns_string(suggestion.text);
|
||||
auto* title_text = suggestion.title.has_value() ? Ladybird::string_to_ns_string(*suggestion.title) : nil;
|
||||
auto* secondary_text = suggestion.subtitle.has_value() ? Ladybird::string_to_ns_string(*suggestion.subtitle) : suggestion_text;
|
||||
auto* favicon = [self.suggestion_icons objectForKey:suggestion_text];
|
||||
auto* icon = suggestion.source == WebView::AutocompleteSuggestionSource::LiteralURL
|
||||
? literal_url_suggestion_icon()
|
||||
@@ -750,7 +751,7 @@ static NSImage* literal_url_suggestion_icon()
|
||||
primary_text_height)];
|
||||
}
|
||||
|
||||
[view.url_text_field setStringValue:suggestion_text];
|
||||
[view.url_text_field setStringValue:(title_text != nil ? secondary_text : suggestion_text)];
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user