mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-08 00:15:46 +01:00
remove flicker when using wop=auto completions and cpt=l; Note: typing after hitting O (or any other long url) is (still) kinda slow, we should try to improve this corner case.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user