mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 22:57:58 +01:00
whitespace fixes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
@@ -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], ["<C-x>"],
|
||||
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 <code class=\"argument\">count</code> if given.",
|
||||
@@ -873,7 +873,7 @@ vimperator.Mappings = function () //{{{
|
||||
}
|
||||
));
|
||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["<C-a>"],
|
||||
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 <code class=\"argument\">count</code> if given.",
|
||||
|
||||
Reference in New Issue
Block a user