diff --git a/NEWS b/NEWS index 5e2c5c41..18ae9c3f 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ generous donation which made this behavior possible) * IMPORTANT: ctrl-x/a never take possible negative URLs into account, it was just too unpredictable + * :set editor now accepts quoting/escaping to use an editor with spaces in the path * support for :%foo as a count for commands (not yet widely used) * show informative message when a background tab was loaded, especially useful with a hidden tab bar. diff --git a/content/buffer.js b/content/buffer.js index 1fc01f9a..c38a8950 100644 --- a/content/buffer.js +++ b/content/buffer.js @@ -1296,7 +1296,7 @@ liberator.Buffer = function () //{{{ // TODO: save return value in v:shell_error var newThread = Components.classes["@mozilla.org/thread-manager;1"].getService().newThread(0); var editor = liberator.options["editor"]; - var args = editor.split(" "); // FIXME: too simple + var args = liberator.commands.parseArgs(editor, [], "*", true).arguments; if (args.length < 1) { liberator.echoerr("no editor specified"); diff --git a/content/commands.js b/content/commands.js index 9e873939..f71e9e76 100644 --- a/content/commands.js +++ b/content/commands.js @@ -277,14 +277,16 @@ liberator.Commands = function () //{{{ // [["-acceleration"], OPTION_FLOAT], // [["-accessories"], OPTION_LIST, null, ["foo", "bar"]], // [["-other"], OPTION_ANY]]; - // argCount can be: + // @param argCount can be: // "0": no arguments // "1": exactly one argument // "+": one or more aguments // "*": zero or more arguments // "?": zero or one arguments + // @param allowUnknownOptions: -foo won't result in an error, if -foo isn't + // specified in "options" // TODO: should it handle comments? - parseArgs: function(str, options, argCount) + parseArgs: function(str, options, argCount, allowUnknownOptions) { // returns [count, parsed_argument] function getNextArg(str) @@ -396,7 +398,7 @@ liberator.Commands = function () //{{{ args.arguments = []; // remaining arguments var invalid = false; - var onlyArgumentsRemaining = false; // after a -- has been found + var onlyArgumentsRemaining = allowUnknownOptions || false; // after a -- has been found var arg = null; var count = 0; // the length of the argument var i = 0; diff --git a/content/editor.js b/content/editor.js index 18b0cf72..4623739e 100644 --- a/content/editor.js +++ b/content/editor.js @@ -748,7 +748,7 @@ liberator.Editor = function () //{{{ return false; var editor = liberator.options["editor"]; - var args = editor.split(" "); + var args = liberator.commands.parseArgs(editor, [], "*", true).arguments; if (args.length < 1) { liberator.echoerr("no editor specified");