mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
UI/Qt: Limit number of autocomplete results to 6
This commit is contained in:
parent
c36a49b61e
commit
944dbfdc97
Notes:
sideshowbarker
2024-07-17 02:39:10 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/944dbfdc97 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/299
@ -124,8 +124,11 @@ ErrorOr<void> AutoComplete::got_network_response(QNetworkReply* reply)
|
|||||||
return Error::from_string_view("Invalid engine name"sv);
|
return Error::from_string_view("Invalid engine name"sv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr size_t MAX_AUTOCOMPLETE_RESULTS = 6;
|
||||||
if (results.is_empty()) {
|
if (results.is_empty()) {
|
||||||
results.append(m_query);
|
results.append(m_query);
|
||||||
|
} else if (results.size() > MAX_AUTOCOMPLETE_RESULTS) {
|
||||||
|
results.shrink(MAX_AUTOCOMPLETE_RESULTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_auto_complete_model->replace_suggestions(move(results));
|
m_auto_complete_model->replace_suggestions(move(results));
|
||||||
|
Loading…
Reference in New Issue
Block a user