mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 00:27:57 +01:00
Fix tab-completion bugs
This commit is contained in:
@@ -384,11 +384,13 @@ function CommandLine() //{{{
|
|||||||
if (idx == -2)
|
if (idx == -2)
|
||||||
list = list.slice().reverse();
|
list = list.slice().reverse();
|
||||||
let n = 0;
|
let n = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.waiting = true;
|
||||||
for (let [,context] in Iterator(list))
|
for (let [,context] in Iterator(list))
|
||||||
{
|
{
|
||||||
function done() !(idx >= n + context.items.length || idx == -2 && !context.items.length);
|
function done() !(idx >= n + context.items.length || idx == -2 && !context.items.length);
|
||||||
while (context.incomplete && !done())
|
while (context.incomplete && !done())
|
||||||
{
|
|
||||||
// threadYield(true, true) would be better, but it does not return on my
|
// threadYield(true, true) would be better, but it does not return on my
|
||||||
// machine until all awesomebar completions were reported, making
|
// machine until all awesomebar completions were reported, making
|
||||||
// :open foo<tab> nearly unusable, if the first 2 foo-completions would
|
// :open foo<tab> nearly unusable, if the first 2 foo-completions would
|
||||||
@@ -408,14 +410,16 @@ function CommandLine() //{{{
|
|||||||
// it has other problems (hitting tab often in a row), until we find the
|
// it has other problems (hitting tab often in a row), until we find the
|
||||||
// source of the problem (which we hopefully do, as I really don't want to
|
// source of the problem (which we hopefully do, as I really don't want to
|
||||||
// have to revert to my hack when better solutions exist)
|
// have to revert to my hack when better solutions exist)
|
||||||
liberator.dump("before yielding");
|
|
||||||
liberator.threadYield(false, true);
|
liberator.threadYield(false, true);
|
||||||
liberator.dump("after yielding");
|
|
||||||
}
|
|
||||||
if (done())
|
if (done())
|
||||||
break;
|
break;
|
||||||
n += context.items.length;
|
n += context.items.length;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
this.waiting = false;
|
||||||
|
}
|
||||||
|
|
||||||
// See previous FIXME. This will break if new items in
|
// See previous FIXME. This will break if new items in
|
||||||
// a previous context come in.
|
// a previous context come in.
|
||||||
@@ -429,6 +433,8 @@ function CommandLine() //{{{
|
|||||||
this.itemList.selectItem(idx);
|
this.itemList.selectItem(idx);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
ntab: 0,
|
||||||
|
|
||||||
tab: function tab(reverse)
|
tab: function tab(reverse)
|
||||||
{
|
{
|
||||||
autocompleteTimer.flush();
|
autocompleteTimer.flush();
|
||||||
@@ -436,6 +442,12 @@ function CommandLine() //{{{
|
|||||||
if (this.context.waitingForTab || this.wildIndex == -1)
|
if (this.context.waitingForTab || this.wildIndex == -1)
|
||||||
this.complete(true, true);
|
this.complete(true, true);
|
||||||
|
|
||||||
|
this.ntab++;
|
||||||
|
if (this.waiting)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (this.ntab--)
|
||||||
|
{
|
||||||
switch (this.wildtype.replace(/.*:/, ""))
|
switch (this.wildtype.replace(/.*:/, ""))
|
||||||
{
|
{
|
||||||
case "":
|
case "":
|
||||||
@@ -454,9 +466,6 @@ function CommandLine() //{{{
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.items.length == 0)
|
|
||||||
return void liberator.beep();
|
|
||||||
|
|
||||||
if (this.type.list)
|
if (this.type.list)
|
||||||
completionList.show();
|
completionList.show();
|
||||||
|
|
||||||
@@ -465,6 +474,10 @@ function CommandLine() //{{{
|
|||||||
|
|
||||||
statusTimer.tell();
|
statusTimer.tell();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.items.length == 0)
|
||||||
|
liberator.beep();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
|||||||
Reference in New Issue
Block a user