mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 10:57:58 +01:00
Fix a completion bug
This commit is contained in:
@@ -466,15 +466,15 @@ function Commands() //{{{
|
|||||||
outer:
|
outer:
|
||||||
while (i < str.length)
|
while (i < str.length)
|
||||||
{
|
{
|
||||||
if (complete)
|
|
||||||
resetCompletions();
|
|
||||||
|
|
||||||
// skip whitespace
|
// skip whitespace
|
||||||
while (/\s/.test(str[i]) && i < str.length)
|
while (/\s/.test(str[i]) && i < str.length)
|
||||||
i++;
|
i++;
|
||||||
if (i == str.length && !complete)
|
if (i == str.length && !complete)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (complete)
|
||||||
|
resetCompletions();
|
||||||
|
|
||||||
var sub = str.substr(i);
|
var sub = str.substr(i);
|
||||||
//liberator.dump(i + ": " + sub + " - " + onlyArgumentsRemaining + "\n");
|
//liberator.dump(i + ": " + sub + " - " + onlyArgumentsRemaining + "\n");
|
||||||
if ((!onlyArgumentsRemaining) && /^--(\s|$)/.test(sub))
|
if ((!onlyArgumentsRemaining) && /^--(\s|$)/.test(sub))
|
||||||
@@ -635,7 +635,7 @@ function Commands() //{{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for correct number of arguments
|
// check for correct number of arguments
|
||||||
if (!complete && (args.arguments.length == 0 && (argCount == "1" || argCount == "+") ||
|
if (!complete && (args.arguments.length == 0 && /^[1+]$/.test(argCount) ||
|
||||||
// TODO: what is this for? -- djk
|
// TODO: what is this for? -- djk
|
||||||
literal && argCount == "+" && /^\s*$/.test(args.literalArg)))
|
literal && argCount == "+" && /^\s*$/.test(args.literalArg)))
|
||||||
{
|
{
|
||||||
@@ -643,7 +643,7 @@ function Commands() //{{{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else if (args.arguments.length == 1 && (argCount == "0") ||
|
else if (args.arguments.length == 1 && (argCount == "0") ||
|
||||||
args.arguments.length > 1 && (argCount == "0" || argCount == "1" || argCount == "?"))
|
args.arguments.length > 1 && /^[01?]$/.test(argCount))
|
||||||
{
|
{
|
||||||
if (!complete)
|
if (!complete)
|
||||||
liberator.echoerr("E488: Trailing characters");
|
liberator.echoerr("E488: Trailing characters");
|
||||||
|
|||||||
Reference in New Issue
Block a user