Skip to content

Commit

Permalink
UI/Qt: Limit number of autocomplete results to 6
Browse files Browse the repository at this point in the history
  • Loading branch information
tcl3 authored and awesomekling committed Jun 27, 2024
1 parent c36a49b commit 944dbfd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Ladybird/Qt/AutoComplete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,11 @@ ErrorOr<void> AutoComplete::got_network_response(QNetworkReply* reply)
return Error::from_string_view("Invalid engine name"sv);
}

constexpr size_t MAX_AUTOCOMPLETE_RESULTS = 6;
if (results.is_empty()) {
results.append(m_query);
} else if (results.size() > MAX_AUTOCOMPLETE_RESULTS) {
results.shrink(MAX_AUTOCOMPLETE_RESULTS);
}

m_auto_complete_model->replace_suggestions(move(results));
Expand Down

0 comments on commit 944dbfd

Please sign in to comment.