From 2cff6aedce69d1b8b1c2a60b2de84c90ceb2a034 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 27 Nov 2008 12:17:59 +0000 Subject: [PATCH] Fix completion of literal args with zero-length filters and argCount = 0. --- content/commands.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/content/commands.js b/content/commands.js index a2ad2983..9ea79307 100644 --- a/content/commands.js +++ b/content/commands.js @@ -187,7 +187,7 @@ function Commands() //{{{ function quote(q, list) { 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 '"': ['"', quote("", '\n\t"\\\\'), '"'], @@ -492,7 +492,7 @@ function Commands() //{{{ } outer: - while (i < str.length) + while (i < str.length || complete) { // skip whitespace while (/\s/.test(str[i]) && i < str.length) @@ -606,13 +606,14 @@ function Commands() //{{{ complete.highlight(i, sub.length, "SPELLCHECK") } + liberator.dump({literal: literal, index: literalIndex, length: length, argCount: argCount}); if (literal && args.length == literalIndex) { + if (complete) + args.completeArg = args.length; args.literalArg = sub; args.push(sub); args.quote = null; - if (complete) - args.completeArg = args.length - 1; break; }