mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 22:37:58 +01:00
Fix tab-completion bugs
This commit is contained in:
@@ -384,11 +384,13 @@ function CommandLine() //{{{
|
||||
if (idx == -2)
|
||||
list = list.slice().reverse();
|
||||
let n = 0;
|
||||
try
|
||||
{
|
||||
this.waiting = true;
|
||||
for (let [,context] in Iterator(list))
|
||||
{
|
||||
function done() !(idx >= n + context.items.length || idx == -2 && !context.items.length);
|
||||
while (context.incomplete && !done())
|
||||
{
|
||||
// threadYield(true, true) would be better, but it does not return on my
|
||||
// machine until all awesomebar completions were reported, making
|
||||
// :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
|
||||
// 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)
|
||||
liberator.dump("before yielding");
|
||||
liberator.threadYield(false, true);
|
||||
liberator.dump("after yielding");
|
||||
}
|
||||
if (done())
|
||||
break;
|
||||
n += context.items.length;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.waiting = false;
|
||||
}
|
||||
|
||||
// See previous FIXME. This will break if new items in
|
||||
// a previous context come in.
|
||||
@@ -429,6 +433,8 @@ function CommandLine() //{{{
|
||||
this.itemList.selectItem(idx);
|
||||
},
|
||||
|
||||
ntab: 0,
|
||||
|
||||
tab: function tab(reverse)
|
||||
{
|
||||
autocompleteTimer.flush();
|
||||
@@ -436,6 +442,12 @@ function CommandLine() //{{{
|
||||
if (this.context.waitingForTab || this.wildIndex == -1)
|
||||
this.complete(true, true);
|
||||
|
||||
this.ntab++;
|
||||
if (this.waiting)
|
||||
return;
|
||||
|
||||
while (this.ntab--)
|
||||
{
|
||||
switch (this.wildtype.replace(/.*:/, ""))
|
||||
{
|
||||
case "":
|
||||
@@ -454,9 +466,6 @@ function CommandLine() //{{{
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.items.length == 0)
|
||||
return void liberator.beep();
|
||||
|
||||
if (this.type.list)
|
||||
completionList.show();
|
||||
|
||||
@@ -465,6 +474,10 @@ function CommandLine() //{{{
|
||||
|
||||
statusTimer.tell();
|
||||
}
|
||||
|
||||
if (this.items.length == 0)
|
||||
liberator.beep();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
|
||||
Reference in New Issue
Block a user