1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 04:07:58 +01:00

Fix <Tab> with async completions

This commit is contained in:
Kris Maglione
2008-12-04 10:25:13 -05:00
parent 6ae1fa663e
commit 5791543e89

View File

@@ -101,7 +101,7 @@ function CommandLine() //{{{
let self = this; let self = this;
context.onUpdate = function () context.onUpdate = function ()
{ {
self.reset(); self.reset(true);
}; };
this.context = context; this.context = context;
this.editor = context.editor; this.editor = context.editor;
@@ -159,7 +159,7 @@ function CommandLine() //{{{
full: this.wildmode.checkHas(this.wildtype, "full") full: this.wildmode.checkHas(this.wildtype, "full")
}), }),
complete: function (show, tabPressed) complete: function complete(show, tabPressed)
{ {
this.context.reset(); this.context.reset();
this.context.tabPressed = tabPressed; this.context.tabPressed = tabPressed;
@@ -169,9 +169,9 @@ function CommandLine() //{{{
preview: function preview() preview: function preview()
{ {
if (this.wildtype < 0 || this.suffix || !this.items.length)
return;
this.previewClear(); this.previewClear();
if (this.wildIndex < 0 || this.suffix || !this.items.length)
return;
let substring = ""; let substring = "";
switch (this.wildtype.replace(/.*:/, "")) switch (this.wildtype.replace(/.*:/, ""))
@@ -946,8 +946,6 @@ function CommandLine() //{{{
onEvent: function onEvent(event) onEvent: function onEvent(event)
{ {
if (completions)
completions.previewClear();
let command = this.getCommand(); let command = this.getCommand();
if (event.type == "blur") if (event.type == "blur")
@@ -973,10 +971,14 @@ function CommandLine() //{{{
} }
else if (event.type == "input") else if (event.type == "input")
{ {
if (completions)
completions.previewClear();
liberator.triggerCallback("change", currentExtendedMode, command); liberator.triggerCallback("change", currentExtendedMode, command);
} }
else if (event.type == "keypress") else if (event.type == "keypress")
{ {
if (completions)
completions.previewClear();
if (!currentExtendedMode) if (!currentExtendedMode)
return true; return true;