1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 15:52:29 +01:00

Fix completion of literal args with zero-length filters and argCount = 0.

This commit is contained in:
Kris Maglione
2008-11-27 12:17:59 +00:00
parent d93e75aea2
commit 2cff6aedce

View File

@@ -187,7 +187,7 @@ function Commands() //{{{
function quote(q, list) function quote(q, list)
{ {
let re = RegExp("[" + list + "]", "g"); let re = RegExp("[" + list + "]", "g");
return function (str) q + String.replace(str, re, function ($0, $1) $1 in quoteMap ? quoteMap[$1] : "\\" + $1) + q; return function (str) q + String.replace(str, re, function ($0) $0 in quoteMap ? quoteMap[$0] : ("\\" + $0)) + q;
} }
const complQuote = { // FIXME const complQuote = { // FIXME
'"': ['"', quote("", '\n\t"\\\\'), '"'], '"': ['"', quote("", '\n\t"\\\\'), '"'],
@@ -492,7 +492,7 @@ function Commands() //{{{
} }
outer: outer:
while (i < str.length) while (i < str.length || complete)
{ {
// skip whitespace // skip whitespace
while (/\s/.test(str[i]) && i < str.length) while (/\s/.test(str[i]) && i < str.length)
@@ -606,13 +606,14 @@ function Commands() //{{{
complete.highlight(i, sub.length, "SPELLCHECK") complete.highlight(i, sub.length, "SPELLCHECK")
} }
liberator.dump({literal: literal, index: literalIndex, length: length, argCount: argCount});
if (literal && args.length == literalIndex) if (literal && args.length == literalIndex)
{ {
if (complete)
args.completeArg = args.length;
args.literalArg = sub; args.literalArg = sub;
args.push(sub); args.push(sub);
args.quote = null; args.quote = null;
if (complete)
args.completeArg = args.length - 1;
break; break;
} }