From c3f142b07d4845b58484206fb4ac513006d1ffbf Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 29 Nov 2007 12:39:38 +0000 Subject: [PATCH] whitespace fixes --- content/commands.js | 136 +++++++++++++++++++++--------------------- content/completion.js | 2 +- content/io.js | 2 +- content/mappings.js | 6 +- 4 files changed, 73 insertions(+), 73 deletions(-) diff --git a/content/commands.js b/content/commands.js index 1bf6588d..3e306c51 100644 --- a/content/commands.js +++ b/content/commands.js @@ -115,7 +115,7 @@ vimperator.Command.prototype = { for (var i = 0; i < this.specs.length; i++) { - if (this.specs[i] == name) // literal command name + if (this.specs[i] == name) // literal command name { return true; } @@ -179,79 +179,79 @@ vimperator.Commands = function () //{{{ { switch (str[i]) { - case "\"": - if (inEscapeKey) - { - inEscapeKey = false; - break; - } - if (!inSingleString) - { - inDoubleString = !inDoubleString; - continue outer; - } - break; - - case "'": - if (inEscapeKey) - { - inEscapeKey = false; - break; - } - if (!inDoubleString) - { - inSingleString = !inSingleString; - continue outer; - } - break; - - // \ is an escape key for non quoted or "-quoted strings - // for '-quoted strings it is taken literally, apart from \' and \\ - case "\\": - if (inEscapeKey) - { - inEscapeKey = false; - break; - } - else - { - // only escape "\\" and "\ " in non quoted strings - if (!inSingleString && !inDoubleString && str[i + 1] != "\\" && str[i + 1] != " ") - continue outer; - // only escape "\\" and "\'" in single quoted strings - else if (inSingleString && str[i + 1] != "\\" && str[i + 1] != "'") + case "\"": + if (inEscapeKey) + { + inEscapeKey = false; break; + } + if (!inSingleString) + { + inDoubleString = !inDoubleString; + continue outer; + } + break; + + case "'": + if (inEscapeKey) + { + inEscapeKey = false; + break; + } + if (!inDoubleString) + { + inSingleString = !inSingleString; + continue outer; + } + break; + + // \ is an escape key for non quoted or "-quoted strings + // for '-quoted strings it is taken literally, apart from \' and \\ + case "\\": + if (inEscapeKey) + { + inEscapeKey = false; + break; + } else { - inEscapeKey = true; - continue outer; + // only escape "\\" and "\ " in non quoted strings + if (!inSingleString && !inDoubleString && str[i + 1] != "\\" && str[i + 1] != " ") + continue outer; + // only escape "\\" and "\'" in single quoted strings + else if (inSingleString && str[i + 1] != "\\" && str[i + 1] != "'") + break; + else + { + inEscapeKey = true; + continue outer; + } } - } - break; + break; - default: - if (inSingleString) - { - inEscapeKey = false; - break; - } - else if (inEscapeKey) - { - inEscapeKey = false; - switch (str[i]) + default: + if (inSingleString) { - case "n": arg += "\n"; continue outer; - case "t": arg += "\t"; continue outer; - default: - break; // this makes "a\fb" -> afb; wanted or should we return ab? --mst + inEscapeKey = false; + break; } - } - else if (!inDoubleString && /\s/.test(str[i])) - { - return [i, arg]; - } - else // a normal charcter - break; + else if (inEscapeKey) + { + inEscapeKey = false; + switch (str[i]) + { + case "n": arg += "\n"; continue outer; + case "t": arg += "\t"; continue outer; + default: + break; // this makes "a\fb" -> afb; wanted or should we return ab? --mst + } + } + else if (!inDoubleString && /\s/.test(str[i])) + { + return [i, arg]; + } + else // a normal charcter + break; } arg += str[i]; } @@ -696,7 +696,7 @@ vimperator.Commands = function () //{{{ default: vimperator.echoerr("Dialog '" + args + "' not available"); } } - catch(err) + catch (err) { vimperator.echoerr("Error opening '" + args + "': " + err); } diff --git a/content/completion.js b/content/completion.js index 0cb87308..7c876641 100644 --- a/content/completion.js +++ b/content/completion.js @@ -643,7 +643,7 @@ vimperator.Completion = function () //{{{ var matches = str.match(/^(:*\d*)\w*$/); if (matches) return [matches[1].length, this.command(cmd)[1]]; - + // dynamically get completions as specified with the command's completer function var command = vimperator.commands.get(cmd); if (command && command.completer) diff --git a/content/io.js b/content/io.js index 3e5a5e10..cefe5d08 100644 --- a/content/io.js +++ b/content/io.js @@ -174,7 +174,7 @@ vimperator.IO = function () //{{{ path = this.getCurrentDirectory() + (WINDOWS ? "\\" : "/") + path; // TODO: for now homedir, later relative to current dir? else path = path.replace(/^file:(\/\/)?/, ""); - + file.initWithPath(path); return file; }, diff --git a/content/mappings.js b/content/mappings.js index 616f358f..e30b53db 100644 --- a/content/mappings.js +++ b/content/mappings.js @@ -848,7 +848,7 @@ vimperator.Mappings = function () //{{{ var regex = /(.*?)(-?\d+)(\D*)$/; var res = url.match(regex); - if(!res || !res[2]) // no number to increment + if (!res || !res[2]) // no number to increment { vimperator.beep(); return; @@ -865,7 +865,7 @@ vimperator.Mappings = function () //{{{ vimperator.open(res[1] + newNum + res[3]); } addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], [""], - function (count) { if(count < 1) count = 1; incrementURL(-count); }, + function (count) { if (count < 1) count = 1; incrementURL(-count); }, { shortHelp: "Decrement last number in URL", help: "Decrements the last number in URL by 1, or by count if given.", @@ -873,7 +873,7 @@ vimperator.Mappings = function () //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], [""], - function (count) { if(count < 1) count = 1; incrementURL(count); }, + function (count) { if (count < 1) count = 1; incrementURL(count); }, { shortHelp: "Increment last number in URL", help: "Increments the last number in URL by 1, or by count if given.",