Bug 344536 - Limit the number of history items displayed the search bar history dropdown, so that some suggestions are always visible. r=gavin
This commit is contained in:
@@ -186,6 +186,14 @@ SuggestAutoComplete.prototype = {
|
||||
*/
|
||||
_formHistoryTimer: null,
|
||||
|
||||
/**
|
||||
* Maximum number of history items displayed. This is capped at 7
|
||||
* because the primary consumer (Firefox search bar) displays 10 rows
|
||||
* by default, and so we want to leave some space for suggestions
|
||||
* to be visible.
|
||||
*/
|
||||
_historyLimit: 7,
|
||||
|
||||
/**
|
||||
* This clears all the per-request state.
|
||||
*/
|
||||
@@ -319,7 +327,8 @@ SuggestAutoComplete.prototype = {
|
||||
if (this._includeFormHistory && this._formHistoryResult &&
|
||||
(this._formHistoryResult.searchResult ==
|
||||
Ci.nsIAutoCompleteResult.RESULT_SUCCESS)) {
|
||||
for (var i = 0; i < this._formHistoryResult.matchCount; ++i) {
|
||||
var maxHistoryItems = Math.min(this._formHistoryResult.matchCount, this._historyLimit);
|
||||
for (var i = 0; i < maxHistoryItems; ++i) {
|
||||
var term = this._formHistoryResult.getValueAt(i);
|
||||
|
||||
// we don't want things to appear in both history and suggestions
|
||||
|
||||
Reference in New Issue
Block a user