diff --git a/content/completion.js b/content/completion.js index 4b54ee83..2e8d4620 100644 --- a/content/completion.js +++ b/content/completion.js @@ -58,11 +58,6 @@ function Completion() //{{{ var completionCache = []; var historyTimer = new util.Timer(50, 100, function histTimer() { - // don't set all completions again every time the timer fires, even - // though items might not have changed - if (historyCache.length == historyResult.matchCount) - return; - let comp = []; for (let i in util.range(0, historyResult.matchCount)) comp.push([historyResult.getValueAt(i), @@ -73,7 +68,8 @@ function Completion() //{{{ // TODO: we need to have a "completionCacheAfter" to allow cpt=slf historyCache = comp; - commandline.setCompletions({ get items() { return completionCache.concat(historyCache); } }); + commandline.setCompletions({ get items() completionCache.concat(historyCache), + incompleteResult: historyResult.searchResult >= historyResult.RESULT_NOMATCH_ONGOING ? true : false }); }); function Javascript() @@ -1319,7 +1315,8 @@ function Completion() //{{{ } } - return { start: start, items: completions, getMoreItems: getMoreItems }; + // TODO: incomplete result should be set conditionally + return { start: start, items: completions, getMoreItems: getMoreItems, incompleteResult: true }; }, userCommand: function userCommand(filter) diff --git a/content/ui.js b/content/ui.js index a4a4649c..a9756ec1 100644 --- a/content/ui.js +++ b/content/ui.js @@ -1227,10 +1227,9 @@ function CommandLine() //{{{ if (liberator.mode != modes.COMMAND_LINE) return; - /* Only hide if not pending. - if (compl.length == 0) - return completionList.hide(); - */ + // don't show an empty result, if we are just waiting for data to arrive + if (newCompletions.incompleteResult && newCompletions.items.length == 0) + return; completionList.setItems(newCompletions.items); @@ -1258,7 +1257,6 @@ function CommandLine() //{{{ var command = this.getCommand(); completionPrefix = command.substring(0, commandWidget.selectionStart); completionPostfix = command.substring(commandWidget.selectionStart); - }, // TODO: does that function need to be public? @@ -1266,7 +1264,7 @@ function CommandLine() //{{{ { autocompleteTimer.reset(); completion.cancel(); - completions = { start: 0, items: [] }; + completions = { start: completions.start, items: [] }; completionIndex = historyIndex = UNINITIALIZED; wildIndex = 0; }