mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-09 21:15:47 +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 completionCache = [];
|
||||||
|
|
||||||
var historyTimer = new util.Timer(50, 100, function histTimer() {
|
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 = [];
|
let comp = [];
|
||||||
for (let i in util.range(0, historyResult.matchCount))
|
for (let i in util.range(0, historyResult.matchCount))
|
||||||
comp.push([historyResult.getValueAt(i),
|
comp.push([historyResult.getValueAt(i),
|
||||||
@@ -73,7 +68,8 @@ function Completion() //{{{
|
|||||||
|
|
||||||
// TODO: we need to have a "completionCacheAfter" to allow cpt=slf
|
// TODO: we need to have a "completionCacheAfter" to allow cpt=slf
|
||||||
historyCache = comp;
|
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()
|
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)
|
userCommand: function userCommand(filter)
|
||||||
|
|||||||
@@ -1227,10 +1227,9 @@ function CommandLine() //{{{
|
|||||||
if (liberator.mode != modes.COMMAND_LINE)
|
if (liberator.mode != modes.COMMAND_LINE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Only hide if not pending.
|
// don't show an empty result, if we are just waiting for data to arrive
|
||||||
if (compl.length == 0)
|
if (newCompletions.incompleteResult && newCompletions.items.length == 0)
|
||||||
return completionList.hide();
|
return;
|
||||||
*/
|
|
||||||
|
|
||||||
completionList.setItems(newCompletions.items);
|
completionList.setItems(newCompletions.items);
|
||||||
|
|
||||||
@@ -1258,7 +1257,6 @@ function CommandLine() //{{{
|
|||||||
var command = this.getCommand();
|
var command = this.getCommand();
|
||||||
completionPrefix = command.substring(0, commandWidget.selectionStart);
|
completionPrefix = command.substring(0, commandWidget.selectionStart);
|
||||||
completionPostfix = command.substring(commandWidget.selectionStart);
|
completionPostfix = command.substring(commandWidget.selectionStart);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: does that function need to be public?
|
// TODO: does that function need to be public?
|
||||||
@@ -1266,7 +1264,7 @@ function CommandLine() //{{{
|
|||||||
{
|
{
|
||||||
autocompleteTimer.reset();
|
autocompleteTimer.reset();
|
||||||
completion.cancel();
|
completion.cancel();
|
||||||
completions = { start: 0, items: [] };
|
completions = { start: completions.start, items: [] };
|
||||||
completionIndex = historyIndex = UNINITIALIZED;
|
completionIndex = historyIndex = UNINITIALIZED;
|
||||||
wildIndex = 0;
|
wildIndex = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user