From dc85f9f619ba61a0925a3283290a352a91fff03a Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 10 Dec 2008 17:10:55 +1100 Subject: [PATCH] use literalArg with :! --- common/content/io.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/common/content/io.js b/common/content/io.js index 93c90a3a..11ae8c47 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -340,16 +340,15 @@ function IO() //{{{ "Run a command", function (args) { - let special = args.bang; - args = args.string; + let arg = args.literalArg; // :!! needs to be treated specially as the command parser sets the - // special flag but removes the ! from args - if (special) - args = "!" + args; + // bang flag but removes the ! from arg + if (args.bang) + arg = "!" + arg; // replaceable bang and no previous command? - if (/((^|[^\\])(\\\\)*)!/.test(args) && !lastRunCommand) + if (/((^|[^\\])(\\\\)*)!/.test(arg) && !lastRunCommand) { liberator.echoerr("E34: No previous command"); return; @@ -357,13 +356,13 @@ function IO() //{{{ // NOTE: Vim doesn't replace ! preceded by 2 or more backslashes and documents it - desirable? // pass through a raw bang when escaped or substitute the last command - args = args.replace(/(\\)*!/g, + arg = arg.replace(/(\\)*!/g, function (m) /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", lastRunCommand) ); - lastRunCommand = args; + lastRunCommand = arg; - let output = io.system(args); + let output = io.system(arg); commandline.echo(template.commandOutput({output}));