mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 06:38:12 +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++)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -179,79 +179,79 @@ vimperator.Commands = function () //{{{
|
|||||||
{
|
{
|
||||||
switch (str[i])
|
switch (str[i])
|
||||||
{
|
{
|
||||||
case "\"":
|
case "\"":
|
||||||
if (inEscapeKey)
|
if (inEscapeKey)
|
||||||
{
|
{
|
||||||
inEscapeKey = false;
|
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] != "'")
|
|
||||||
break;
|
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
|
else
|
||||||
{
|
{
|
||||||
inEscapeKey = true;
|
// only escape "\\" and "\ " in non quoted strings
|
||||||
continue outer;
|
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:
|
default:
|
||||||
if (inSingleString)
|
if (inSingleString)
|
||||||
{
|
|
||||||
inEscapeKey = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (inEscapeKey)
|
|
||||||
{
|
|
||||||
inEscapeKey = false;
|
|
||||||
switch (str[i])
|
|
||||||
{
|
{
|
||||||
case "n": arg += "\n"; continue outer;
|
inEscapeKey = false;
|
||||||
case "t": arg += "\t"; continue outer;
|
break;
|
||||||
default:
|
|
||||||
break; // this makes "a\fb" -> afb; wanted or should we return ab? --mst
|
|
||||||
}
|
}
|
||||||
}
|
else if (inEscapeKey)
|
||||||
else if (!inDoubleString && /\s/.test(str[i]))
|
{
|
||||||
{
|
inEscapeKey = false;
|
||||||
return [i, arg];
|
switch (str[i])
|
||||||
}
|
{
|
||||||
else // a normal charcter
|
case "n": arg += "\n"; continue outer;
|
||||||
break;
|
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];
|
arg += str[i];
|
||||||
}
|
}
|
||||||
@@ -696,7 +696,7 @@ vimperator.Commands = function () //{{{
|
|||||||
default: vimperator.echoerr("Dialog '" + args + "' not available");
|
default: vimperator.echoerr("Dialog '" + args + "' not available");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(err)
|
catch (err)
|
||||||
{
|
{
|
||||||
vimperator.echoerr("Error opening '" + args + "': " + err);
|
vimperator.echoerr("Error opening '" + args + "': " + err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -848,7 +848,7 @@ vimperator.Mappings = function () //{{{
|
|||||||
var regex = /(.*?)(-?\d+)(\D*)$/;
|
var regex = /(.*?)(-?\d+)(\D*)$/;
|
||||||
|
|
||||||
var res = url.match(regex);
|
var res = url.match(regex);
|
||||||
if(!res || !res[2]) // no number to increment
|
if (!res || !res[2]) // no number to increment
|
||||||
{
|
{
|
||||||
vimperator.beep();
|
vimperator.beep();
|
||||||
return;
|
return;
|
||||||
@@ -865,7 +865,7 @@ vimperator.Mappings = function () //{{{
|
|||||||
vimperator.open(res[1] + newNum + res[3]);
|
vimperator.open(res[1] + newNum + res[3]);
|
||||||
}
|
}
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["<C-x>"],
|
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",
|
shortHelp: "Decrement last number in URL",
|
||||||
help: "Decrements the last number in URL by 1, or by <code class=\"argument\">count</code> if given.",
|
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>"],
|
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",
|
shortHelp: "Increment last number in URL",
|
||||||
help: "Increments the last number in URL by 1, or by <code class=\"argument\">count</code> if given.",
|
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