mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 09:48:00 +01:00
Change multiline error message guard clauses to single line formatting.
Also apply similar formattng fixes to conditional blocks as per standard.
This commit is contained in:
@@ -59,10 +59,7 @@ function Buffer() //{{{
|
|||||||
function setZoom(value, fullZoom)
|
function setZoom(value, fullZoom)
|
||||||
{
|
{
|
||||||
if (value < ZOOM_MIN || value > ZOOM_MAX)
|
if (value < ZOOM_MIN || value > ZOOM_MAX)
|
||||||
{
|
return void liberator.echoerr("Zoom value out of range (" + ZOOM_MIN + " - " + ZOOM_MAX + "%)");
|
||||||
liberator.echoerr("Zoom value out of range (" + ZOOM_MIN + " - " + ZOOM_MAX + "%)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZoomManager.useFullZoom = fullZoom;
|
ZoomManager.useFullZoom = fullZoom;
|
||||||
ZoomManager.zoom = value / 100;
|
ZoomManager.zoom = value / 100;
|
||||||
@@ -533,7 +530,7 @@ function Buffer() //{{{
|
|||||||
|
|
||||||
// FIXME: arg handling is a bit of a mess, check for filename
|
// FIXME: arg handling is a bit of a mess, check for filename
|
||||||
if (arg && (liberator.has("Win32") || arg[0] != ">"))
|
if (arg && (liberator.has("Win32") || arg[0] != ">"))
|
||||||
return liberator.echoerr("E488: Trailing characters");
|
return void liberator.echoerr("E488: Trailing characters");
|
||||||
|
|
||||||
options.withContext(function () {
|
options.withContext(function () {
|
||||||
if (arg)
|
if (arg)
|
||||||
@@ -543,9 +540,7 @@ function Buffer() //{{{
|
|||||||
liberator.echomsg("Printing to file: " + arg.substr(1));
|
liberator.echomsg("Printing to file: " + arg.substr(1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
liberator.echomsg("Sending to printer...");
|
liberator.echomsg("Sending to printer...");
|
||||||
}
|
|
||||||
|
|
||||||
options.setPref("print.always_print_silent", args.bang);
|
options.setPref("print.always_print_silent", args.bang);
|
||||||
options.setPref("print.show_print_progress", !args.bang);
|
options.setPref("print.show_print_progress", !args.bang);
|
||||||
@@ -585,10 +580,7 @@ function Buffer() //{{{
|
|||||||
let titles = buffer.alternateStyleSheets.map(function (stylesheet) stylesheet.title);
|
let titles = buffer.alternateStyleSheets.map(function (stylesheet) stylesheet.title);
|
||||||
|
|
||||||
if (arg && titles.indexOf(arg) == -1)
|
if (arg && titles.indexOf(arg) == -1)
|
||||||
{
|
return void liberator.echoerr("E475: Invalid argument: " + arg);
|
||||||
liberator.echoerr("E475: Invalid argument: " + arg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options["usermode"])
|
if (options["usermode"])
|
||||||
options["usermode"] = false;
|
options["usermode"] = false;
|
||||||
@@ -673,13 +665,9 @@ function Buffer() //{{{
|
|||||||
let level;
|
let level;
|
||||||
|
|
||||||
if (!arg)
|
if (!arg)
|
||||||
{
|
|
||||||
level = 100;
|
level = 100;
|
||||||
}
|
|
||||||
else if (/^\d+$/.test(arg))
|
else if (/^\d+$/.test(arg))
|
||||||
{
|
|
||||||
level = parseInt(arg, 10);
|
level = parseInt(arg, 10);
|
||||||
}
|
|
||||||
else if (/^[+-]\d+$/.test(arg))
|
else if (/^[+-]\d+$/.test(arg))
|
||||||
{
|
{
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
@@ -694,10 +682,7 @@ function Buffer() //{{{
|
|||||||
level = ZOOM_MAX;
|
level = ZOOM_MAX;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
return void liberator.echoerr("E488: Trailing characters");
|
||||||
liberator.echoerr("E488: Trailing characters");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
buffer.fullZoom = level;
|
buffer.fullZoom = level;
|
||||||
@@ -1735,15 +1720,9 @@ function Marks() //{{{
|
|||||||
args = args.string;
|
args = args.string;
|
||||||
|
|
||||||
if (!special && !args)
|
if (!special && !args)
|
||||||
{
|
return void liberator.echoerr("E471: Argument required");
|
||||||
liberator.echoerr("E471: Argument required");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (special && args)
|
if (special && args)
|
||||||
{
|
return void liberator.echoerr("E474: Invalid argument");
|
||||||
liberator.echoerr("E474: Invalid argument");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let matches;
|
let matches;
|
||||||
if (matches = args.match(/(?:(?:^|[^a-zA-Z0-9])-|-(?:$|[^a-zA-Z0-9])|[^a-zA-Z0-9 -]).*/))
|
if (matches = args.match(/(?:(?:^|[^a-zA-Z0-9])-|-(?:$|[^a-zA-Z0-9])|[^a-zA-Z0-9 -]).*/))
|
||||||
{
|
{
|
||||||
@@ -1784,15 +1763,9 @@ function Marks() //{{{
|
|||||||
{
|
{
|
||||||
let mark = args[0];
|
let mark = args[0];
|
||||||
if (mark.length > 1)
|
if (mark.length > 1)
|
||||||
{
|
return void liberator.echoerr("E488: Trailing characters");
|
||||||
liberator.echoerr("E488: Trailing characters");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!/[a-zA-Z]/.test(mark))
|
if (!/[a-zA-Z]/.test(mark))
|
||||||
{
|
return void liberator.echoerr("E191: Argument must be a letter or forward/backward quote");
|
||||||
liberator.echoerr("E191: Argument must be a letter or forward/backward quote");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
marks.add(mark);
|
marks.add(mark);
|
||||||
},
|
},
|
||||||
@@ -1806,10 +1779,7 @@ function Marks() //{{{
|
|||||||
|
|
||||||
// ignore invalid mark characters unless there are no valid mark chars
|
// ignore invalid mark characters unless there are no valid mark chars
|
||||||
if (args && !/[a-zA-Z]/.test(args))
|
if (args && !/[a-zA-Z]/.test(args))
|
||||||
{
|
return void liberator.echoerr("E283: No marks matching " + args.quote());
|
||||||
liberator.echoerr("E283: No marks matching " + args.quote());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let filter = args.replace(/[^a-zA-Z]/g, "");
|
let filter = args.replace(/[^a-zA-Z]/g, "");
|
||||||
marks.list(filter);
|
marks.list(filter);
|
||||||
@@ -1973,19 +1943,13 @@ function Marks() //{{{
|
|||||||
let marks = getSortedMarks();
|
let marks = getSortedMarks();
|
||||||
|
|
||||||
if (marks.length == 0)
|
if (marks.length == 0)
|
||||||
{
|
return void liberator.echoerr("No marks set");
|
||||||
liberator.echoerr("No marks set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.length > 0)
|
if (filter.length > 0)
|
||||||
{
|
{
|
||||||
marks = marks.filter(function (mark) filter.indexOf(mark[0]) >= 0);
|
marks = marks.filter(function (mark) filter.indexOf(mark[0]) >= 0);
|
||||||
if (marks.length == 0)
|
if (marks.length == 0)
|
||||||
{
|
return void liberator.echoerr("E283: No marks matching " + filter.quote());
|
||||||
liberator.echoerr("E283: No marks matching " + filter.quote());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let list = template.tabular(["mark", "line", "col", "file"],
|
let list = template.tabular(["mark", "line", "col", "file"],
|
||||||
|
|||||||
@@ -375,9 +375,7 @@ function Commands() //{{{
|
|||||||
if (exCommands.some(function (c) c.hasName(command.name)))
|
if (exCommands.some(function (c) c.hasName(command.name)))
|
||||||
{
|
{
|
||||||
if (isUserCommand && replace)
|
if (isUserCommand && replace)
|
||||||
{
|
|
||||||
commands.removeUserCommand(command.name);
|
commands.removeUserCommand(command.name);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
liberator.log("Warning: :" + command.name + " already exists, NOT replacing existing command.", 1);
|
liberator.log("Warning: :" + command.name + " already exists, NOT replacing existing command.", 1);
|
||||||
@@ -716,7 +714,7 @@ function Commands() //{{{
|
|||||||
{
|
{
|
||||||
[count, arg, quote, error] = getNextArg(sub.substr(optname.length + 1));
|
[count, arg, quote, error] = getNextArg(sub.substr(optname.length + 1));
|
||||||
if (error)
|
if (error)
|
||||||
return liberator.echoerr(error);
|
return void liberator.echoerr(error);
|
||||||
|
|
||||||
// if we add the argument to an option after a space, it MUST not be empty
|
// if we add the argument to an option after a space, it MUST not be empty
|
||||||
if (sep != "=" && !quote && arg.length == 0)
|
if (sep != "=" && !quote && arg.length == 0)
|
||||||
@@ -725,9 +723,7 @@ function Commands() //{{{
|
|||||||
count++; // to compensate the "=" character
|
count++; // to compensate the "=" character
|
||||||
}
|
}
|
||||||
else if (!/\s/.test(sep) && sep != undefined) // this isn't really an option as it has trailing characters, parse it as an argument
|
else if (!/\s/.test(sep) && sep != undefined) // this isn't really an option as it has trailing characters, parse it as an argument
|
||||||
{
|
|
||||||
invalid = true;
|
invalid = true;
|
||||||
}
|
|
||||||
|
|
||||||
let context = null;
|
let context = null;
|
||||||
if (!complete && quote)
|
if (!complete && quote)
|
||||||
@@ -807,7 +803,7 @@ function Commands() //{{{
|
|||||||
// if not an option, treat this token as an argument
|
// if not an option, treat this token as an argument
|
||||||
let [count, arg, quote, error] = getNextArg(sub);
|
let [count, arg, quote, error] = getNextArg(sub);
|
||||||
if (error)
|
if (error)
|
||||||
return liberator.echoerr(error);
|
return void liberator.echoerr(error);
|
||||||
|
|
||||||
if (complete)
|
if (complete)
|
||||||
{
|
{
|
||||||
@@ -997,10 +993,7 @@ function Commands() //{{{
|
|||||||
let cmd = args[0];
|
let cmd = args[0];
|
||||||
|
|
||||||
if (cmd != null && /\W/.test(cmd))
|
if (cmd != null && /\W/.test(cmd))
|
||||||
{
|
return void liberator.echoerr("E182: Invalid command name");
|
||||||
liberator.echoerr("E182: Invalid command name");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.literalArg)
|
if (args.literalArg)
|
||||||
{
|
{
|
||||||
@@ -1036,9 +1029,7 @@ function Commands() //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
completeFunc = completion[completeOptionMap[completeOpt]];
|
completeFunc = completion[completeOptionMap[completeOpt]];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let added = commands.addUserCommand([cmd],
|
let added = commands.addUserCommand([cmd],
|
||||||
@@ -1083,9 +1074,7 @@ function Commands() //{{{
|
|||||||
commandline.echo(str, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
|
commandline.echo(str, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
liberator.echomsg("No user-defined commands found");
|
liberator.echomsg("No user-defined commands found");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -537,13 +537,9 @@ function Editor() //{{{
|
|||||||
function (count)
|
function (count)
|
||||||
{
|
{
|
||||||
if (modes.main == modes.VISUAL)
|
if (modes.main == modes.VISUAL)
|
||||||
{
|
|
||||||
count = getEditor().selectionEnd - getEditor().selectionStart;
|
count = getEditor().selectionEnd - getEditor().selectionStart;
|
||||||
}
|
|
||||||
if (typeof count != "number" || count < 1)
|
if (typeof count != "number" || count < 1)
|
||||||
{
|
|
||||||
count = 1;
|
count = 1;
|
||||||
}
|
|
||||||
|
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
@@ -867,10 +863,7 @@ function Editor() //{{{
|
|||||||
let args = commands.parseArgs(options["editor"], [], "*", true);
|
let args = commands.parseArgs(options["editor"], [], "*", true);
|
||||||
|
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
return void liberator.echoerr("No editor specified");
|
||||||
liberator.echoerr("No editor specified");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
args.push(path);
|
args.push(path);
|
||||||
liberator.callFunctionInThread(null, io.run, io.expandPath(args.shift()), args, true);
|
liberator.callFunctionInThread(null, io.run, io.expandPath(args.shift()), args, true);
|
||||||
@@ -1038,9 +1031,7 @@ function Editor() //{{{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1125,9 +1116,7 @@ function Editor() //{{{
|
|||||||
let list = this.getAbbreviations(filter, lhs);
|
let list = this.getAbbreviations(filter, lhs);
|
||||||
|
|
||||||
if (!list.length)
|
if (!list.length)
|
||||||
{
|
|
||||||
liberator.echomsg("No abbreviations found");
|
liberator.echomsg("No abbreviations found");
|
||||||
}
|
|
||||||
else if (list.length == 1)
|
else if (list.length == 1)
|
||||||
{
|
{
|
||||||
let [mode, lhs, rhs] = list[0];
|
let [mode, lhs, rhs] = list[0];
|
||||||
|
|||||||
@@ -80,10 +80,7 @@ function AutoCommands() //{{{
|
|||||||
|
|
||||||
events = event.split(",");
|
events = event.split(",");
|
||||||
if (!events.every(function (event) validEvents.indexOf(event) >= 0))
|
if (!events.every(function (event) validEvents.indexOf(event) >= 0))
|
||||||
{
|
return void liberator.echoerr("E216: No such group or event: " + event);
|
||||||
liberator.echoerr("E216: No such group or event: " + event);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd) // add new command, possibly removing all others with the same event/pattern
|
if (cmd) // add new command, possibly removing all others with the same event/pattern
|
||||||
@@ -104,9 +101,7 @@ function AutoCommands() //{{{
|
|||||||
autocommands.remove(event, regex); // remove all
|
autocommands.remove(event, regex); // remove all
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
autocommands.list(event, regex); // list all
|
autocommands.list(event, regex); // list all
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -146,13 +141,9 @@ function AutoCommands() //{{{
|
|||||||
let validEvents = config.autocommands.map(function (e) e[0]);
|
let validEvents = config.autocommands.map(function (e) e[0]);
|
||||||
|
|
||||||
if (event == "*")
|
if (event == "*")
|
||||||
{
|
|
||||||
liberator.echoerr("E217: Can't execute autocommands for ALL events");
|
liberator.echoerr("E217: Can't execute autocommands for ALL events");
|
||||||
}
|
|
||||||
else if (validEvents.indexOf(event) == -1)
|
else if (validEvents.indexOf(event) == -1)
|
||||||
{
|
|
||||||
liberator.echoerr("E216: No such group or event: " + args);
|
liberator.echoerr("E216: No such group or event: " + args);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: perhaps trigger could return the number of autocmds triggered
|
// TODO: perhaps trigger could return the number of autocmds triggered
|
||||||
@@ -314,9 +305,7 @@ function AutoCommands() //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
liberator.execute(commands.replaceTokens(autoCmd.command, args), null, true);
|
liberator.execute(commands.replaceTokens(autoCmd.command, args), null, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -603,9 +592,7 @@ function Events() //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // background tab
|
else // background tab
|
||||||
{
|
|
||||||
liberator.echomsg("Background tab loaded: " + title || url, 3);
|
liberator.echomsg("Background tab loaded: " + title || url, 3);
|
||||||
}
|
|
||||||
|
|
||||||
triggerLoadAutocmd("PageLoad", doc);
|
triggerLoadAutocmd("PageLoad", doc);
|
||||||
}
|
}
|
||||||
@@ -663,9 +650,7 @@ function Events() //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
liberator.log("No user macros directory found", 3);
|
liberator.log("No user macros directory found", 3);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
@@ -733,10 +718,7 @@ function Events() //{{{
|
|||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
if (args.bang && args.string)
|
if (args.bang && args.string)
|
||||||
{
|
return void liberator.echoerr("E474: Invalid argument");
|
||||||
liberator.echoerr("E474: Invalid argument");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
events.deleteMacros();
|
events.deleteMacros();
|
||||||
@@ -811,11 +793,8 @@ function Events() //{{{
|
|||||||
startRecording: function (macro)
|
startRecording: function (macro)
|
||||||
{
|
{
|
||||||
if (!/[a-zA-Z0-9]/.test(macro))
|
if (!/[a-zA-Z0-9]/.test(macro))
|
||||||
{
|
|
||||||
// TODO: ignore this like Vim?
|
// TODO: ignore this like Vim?
|
||||||
liberator.echoerr("E354: Invalid register name: '" + macro + "'");
|
return void liberator.echoerr("E354: Invalid register name: '" + macro + "'");
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
modes.isRecording = true;
|
modes.isRecording = true;
|
||||||
|
|
||||||
@@ -981,21 +960,13 @@ function Events() //{{{
|
|||||||
charCode = keyname.charCodeAt(0);
|
charCode = keyname.charCodeAt(0);
|
||||||
}
|
}
|
||||||
else if (keyname.toLowerCase() == "space")
|
else if (keyname.toLowerCase() == "space")
|
||||||
{
|
|
||||||
charCode = 32;
|
charCode = 32;
|
||||||
}
|
|
||||||
else if (keyname.toLowerCase() == "nop")
|
else if (keyname.toLowerCase() == "nop")
|
||||||
{
|
|
||||||
string = "<Nop>";
|
string = "<Nop>";
|
||||||
}
|
|
||||||
else if (keyCode = getKeyCode(keyname))
|
else if (keyCode = getKeyCode(keyname))
|
||||||
{
|
|
||||||
charCode = 0;
|
charCode = 0;
|
||||||
}
|
|
||||||
else // an invalid key like <A-xxx> was found, stop propagation here (like Vim)
|
else // an invalid key like <A-xxx> was found, stop propagation here (like Vim)
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
i += match.length - 1;
|
i += match.length - 1;
|
||||||
}
|
}
|
||||||
@@ -1020,9 +991,7 @@ function Events() //{{{
|
|||||||
events.onKeyPress(evt);
|
events.onKeyPress(evt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
elem.dispatchEvent(evt);
|
elem.dispatchEvent(evt);
|
||||||
}
|
|
||||||
if (!this.feedingKeys)
|
if (!this.feedingKeys)
|
||||||
break;
|
break;
|
||||||
// stop feeding keys if page loading failed
|
// stop feeding keys if page loading failed
|
||||||
@@ -1120,9 +1089,7 @@ function Events() //{{{
|
|||||||
modifier = modifier.replace("C-", "");
|
modifier = modifier.replace("C-", "");
|
||||||
}
|
}
|
||||||
else // [Ctrl-Bug 2,3,4,5/5] the <C-\\>, <C-]>, <C-^>, <C-_> bugs
|
else // [Ctrl-Bug 2,3,4,5/5] the <C-\\>, <C-]>, <C-^>, <C-_> bugs
|
||||||
{
|
|
||||||
key = String.fromCharCode(event.charCode + 64);
|
key = String.fromCharCode(event.charCode + 64);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// special handling of the Space key
|
// special handling of the Space key
|
||||||
else if (event.charCode == 32)
|
else if (event.charCode == 32)
|
||||||
@@ -1310,9 +1277,7 @@ function Events() //{{{
|
|||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
modes.reset();
|
modes.reset();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -1422,9 +1387,7 @@ function Events() //{{{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (!mappings.hasMap(liberator.mode, input.buffer + key))
|
else if (!mappings.hasMap(liberator.mode, input.buffer + key))
|
||||||
{
|
|
||||||
macros.set(currentMacro, macros.get(currentMacro) + key);
|
macros.set(currentMacro, macros.get(currentMacro) + key);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == "<C-c>")
|
if (key == "<C-c>")
|
||||||
@@ -1606,9 +1569,7 @@ function Events() //{{{
|
|||||||
else if (input.pendingMotionMap)
|
else if (input.pendingMotionMap)
|
||||||
{
|
{
|
||||||
if (key != "<Esc>" && key != "<C-[>")
|
if (key != "<Esc>" && key != "<C-[>")
|
||||||
{
|
|
||||||
input.pendingMotionMap.execute(candidateCommand, input.count, null);
|
input.pendingMotionMap.execute(candidateCommand, input.count, null);
|
||||||
}
|
|
||||||
input.pendingMotionMap = null;
|
input.pendingMotionMap = null;
|
||||||
input.buffer = "";
|
input.buffer = "";
|
||||||
inputBufferLength = 0;
|
inputBufferLength = 0;
|
||||||
@@ -1671,9 +1632,7 @@ function Events() //{{{
|
|||||||
commandline.onEvent(event); // reroute event in command line mode
|
commandline.onEvent(event); // reroute event in command line mode
|
||||||
}
|
}
|
||||||
else if (liberator.mode != modes.INSERT && liberator.mode != modes.TEXTAREA)
|
else if (liberator.mode != modes.INSERT && liberator.mode != modes.TEXTAREA)
|
||||||
{
|
|
||||||
liberator.beep();
|
liberator.beep();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -409,9 +409,7 @@ function Finder() //{{{
|
|||||||
let result = getBrowser().fastFind.findAgain(up, linksOnly);
|
let result = getBrowser().fastFind.findAgain(up, linksOnly);
|
||||||
|
|
||||||
if (result == Ci.nsITypeAheadFind.FIND_NOTFOUND)
|
if (result == Ci.nsITypeAheadFind.FIND_NOTFOUND)
|
||||||
{
|
|
||||||
liberator.echoerr("E486: Pattern not found: " + lastSearchPattern, commandline.FORCE_SINGLELINE);
|
liberator.echoerr("E486: Pattern not found: " + lastSearchPattern, commandline.FORCE_SINGLELINE);
|
||||||
}
|
|
||||||
else if (result == Ci.nsITypeAheadFind.FIND_WRAPPED)
|
else if (result == Ci.nsITypeAheadFind.FIND_WRAPPED)
|
||||||
{
|
{
|
||||||
// hack needed, because wrapping causes a "scroll" event which clears
|
// hack needed, because wrapping causes a "scroll" event which clears
|
||||||
|
|||||||
@@ -260,9 +260,7 @@ function Hints() //{{{
|
|||||||
|
|
||||||
// If we found a satisfactory offset, let's use it.
|
// If we found a satisfactory offset, let's use it.
|
||||||
if (curdist < Infinity)
|
if (curdist < Infinity)
|
||||||
{
|
|
||||||
return [leftpos + curleft, toppos + curtop]
|
return [leftpos + curleft, toppos + curtop]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {} //badly formed document, or shape == "default" in which case we don't move the hint
|
catch (e) {} //badly formed document, or shape == "default" in which case we don't move the hint
|
||||||
@@ -323,9 +321,7 @@ function Hints() //{{{
|
|||||||
let toppos = Math.max((rect.top + scrollY), scrollY);
|
let toppos = Math.max((rect.top + scrollY), scrollY);
|
||||||
|
|
||||||
if (tagname == "area")
|
if (tagname == "area")
|
||||||
{
|
|
||||||
[leftpos, toppos] = getAreaOffset(elem, leftpos, toppos);
|
[leftpos, toppos] = getAreaOffset(elem, leftpos, toppos);
|
||||||
}
|
|
||||||
|
|
||||||
span.style.left = leftpos + "px";
|
span.style.left = leftpos + "px";
|
||||||
span.style.top = toppos + "px";
|
span.style.top = toppos + "px";
|
||||||
@@ -532,9 +528,7 @@ function Hints() //{{{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (validHints.length > 1)
|
else if (validHints.length > 1)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let timeout = followFirst || events.feedingKeys ? 0 : 500;
|
let timeout = followFirst || events.feedingKeys ? 0 : 500;
|
||||||
|
|||||||
@@ -206,20 +206,13 @@ function IO() //{{{
|
|||||||
let arg = args.literalArg;
|
let arg = args.literalArg;
|
||||||
|
|
||||||
if (!arg)
|
if (!arg)
|
||||||
{
|
|
||||||
arg = "~";
|
arg = "~";
|
||||||
}
|
|
||||||
else if (arg == "-")
|
else if (arg == "-")
|
||||||
{
|
{
|
||||||
if (oldcwd)
|
if (oldcwd)
|
||||||
{
|
|
||||||
arg = oldcwd.path;
|
arg = oldcwd.path;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
return void liberator.echoerr("E186: No previous directory");
|
||||||
liberator.echoerr("E186: No previous directory");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arg = io.expandPath(arg);
|
arg = io.expandPath(arg);
|
||||||
@@ -280,19 +273,13 @@ function IO() //{{{
|
|||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
{
|
return void liberator.echoerr("E172: Only one file name allowed");
|
||||||
liberator.echoerr("E172: Only one file name allowed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let filename = args[0] || io.getRCFile(null, true).path;
|
let filename = args[0] || io.getRCFile(null, true).path;
|
||||||
let file = io.getFile(filename);
|
let file = io.getFile(filename);
|
||||||
|
|
||||||
if (file.exists() && !args.bang)
|
if (file.exists() && !args.bang)
|
||||||
{
|
return void liberator.echoerr("E189: \"" + filename + "\" exists (add ! to override)");
|
||||||
liberator.echoerr("E189: \"" + filename + "\" exists (add ! to override)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Use a set/specifiable list here:
|
// TODO: Use a set/specifiable list here:
|
||||||
let lines = [cmd.serial().map(commands.commandToString) for (cmd in commands) if (cmd.serial)];
|
let lines = [cmd.serial().map(commands.commandToString) for (cmd in commands) if (cmd.serial)];
|
||||||
@@ -375,10 +362,7 @@ function IO() //{{{
|
|||||||
|
|
||||||
// replaceable bang and no previous command?
|
// replaceable bang and no previous command?
|
||||||
if (/((^|[^\\])(\\\\)*)!/.test(arg) && !lastRunCommand)
|
if (/((^|[^\\])(\\\\)*)!/.test(arg) && !lastRunCommand)
|
||||||
{
|
return void liberator.echoerr("E34: No previous command");
|
||||||
liberator.echoerr("E34: No previous command");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: Vim doesn't replace ! preceded by 2 or more backslashes and documents it - desirable?
|
// 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
|
// pass through a raw bang when escaped or substitute the last command
|
||||||
@@ -527,9 +511,7 @@ function IO() //{{{
|
|||||||
newDir = newDir || "~";
|
newDir = newDir || "~";
|
||||||
|
|
||||||
if (newDir == "-")
|
if (newDir == "-")
|
||||||
{
|
|
||||||
[cwd, oldcwd] = [oldcwd, this.getCurrentDirectory()];
|
[cwd, oldcwd] = [oldcwd, this.getCurrentDirectory()];
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
let dir = self.getFile(newDir);
|
let dir = self.getFile(newDir);
|
||||||
@@ -820,9 +802,7 @@ function IO() //{{{
|
|||||||
let file;
|
let file;
|
||||||
|
|
||||||
if (isAbsolutePath(program))
|
if (isAbsolutePath(program))
|
||||||
{
|
|
||||||
file = self.getFile(program, true);
|
file = self.getFile(program, true);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
let dirs = services.get("environment").get("PATH").split(WINDOWS ? ";" : ":");
|
let dirs = services.get("environment").get("PATH").split(WINDOWS ? ";" : ":");
|
||||||
@@ -968,9 +948,7 @@ lookup:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (/\.css$/.test(filename))
|
else if (/\.css$/.test(filename))
|
||||||
{
|
|
||||||
storage.styles.registerSheet(uri.spec, true);
|
storage.styles.registerSheet(uri.spec, true);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
let heredoc = "";
|
let heredoc = "";
|
||||||
@@ -988,9 +966,7 @@ lookup:
|
|||||||
heredocEnd = null;
|
heredocEnd = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
heredoc += line + "\n";
|
heredoc += line + "\n";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1018,9 +994,7 @@ lookup:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (command.name == "finish")
|
if (command.name == "finish")
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
else if (command.hereDoc)
|
else if (command.hereDoc)
|
||||||
{
|
{
|
||||||
// check for a heredoc
|
// check for a heredoc
|
||||||
@@ -1034,9 +1008,7 @@ lookup:
|
|||||||
heredoc = matches[1] + "\n";
|
heredoc = matches[1] + "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
command.execute(args, special, count);
|
command.execute(args, special, count);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -299,10 +299,7 @@ const liberator = (function () //{{{
|
|||||||
let items = getMenuItems();
|
let items = getMenuItems();
|
||||||
|
|
||||||
if (!items.some(function (i) i.fullMenuPath == arg))
|
if (!items.some(function (i) i.fullMenuPath == arg))
|
||||||
{
|
return void liberator.echoerr("E334: Menu not found: " + arg);
|
||||||
liberator.echoerr("E334: Menu not found: " + arg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let [,item] in Iterator(items))
|
for (let [,item] in Iterator(items))
|
||||||
{
|
{
|
||||||
@@ -333,7 +330,6 @@ const liberator = (function () //{{{
|
|||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
liberator.echoerr(e);
|
liberator.echoerr(e);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -350,10 +346,7 @@ const liberator = (function () //{{{
|
|||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
{
|
return void liberator.echoerr("E478: Don't panic!");
|
||||||
liberator.echoerr("E478: Don't panic!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
liberator.help(args.literalArg);
|
liberator.help(args.literalArg);
|
||||||
},
|
},
|
||||||
@@ -480,9 +473,7 @@ const liberator = (function () //{{{
|
|||||||
totalUnits = "sec";
|
totalUnits = "sec";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
totalUnits = "msec";
|
totalUnits = "msec";
|
||||||
}
|
|
||||||
|
|
||||||
let str = template.commandOutput(
|
let str = template.commandOutput(
|
||||||
<table>
|
<table>
|
||||||
@@ -811,10 +802,7 @@ const liberator = (function () //{{{
|
|||||||
let opt = this.options.get(matches[1]);
|
let opt = this.options.get(matches[1]);
|
||||||
|
|
||||||
if (!opt)
|
if (!opt)
|
||||||
{
|
return void this.echoerr("E113: Unknown option: " + matches[1]);
|
||||||
this.echoerr("E113: Unknown option: " + matches[1]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let type = opt.type;
|
let type = opt.type;
|
||||||
let value = opt.getter();
|
let value = opt.getter();
|
||||||
@@ -829,21 +817,14 @@ const liberator = (function () //{{{
|
|||||||
else if (matches = string.match(/^(['"])([^\1]*?[^\\]?)\1/))
|
else if (matches = string.match(/^(['"])([^\1]*?[^\\]?)\1/))
|
||||||
{
|
{
|
||||||
if (matches)
|
if (matches)
|
||||||
{
|
|
||||||
return matches[2].toString();
|
return matches[2].toString();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
return void this.echoerr("E115: Missing quote: " + string);
|
||||||
this.echoerr("E115: Missing quote: " + string);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number
|
// Number
|
||||||
else if (matches = string.match(/^(\d+)$/))
|
else if (matches = string.match(/^(\d+)$/))
|
||||||
{
|
|
||||||
return parseInt(matches[1], 10);
|
return parseInt(matches[1], 10);
|
||||||
}
|
|
||||||
|
|
||||||
let reference = this.variableReference(string);
|
let reference = this.variableReference(string);
|
||||||
|
|
||||||
@@ -874,20 +855,14 @@ const liberator = (function () //{{{
|
|||||||
liberator.focusContent();
|
liberator.focusContent();
|
||||||
}
|
}
|
||||||
else if (command.action === null)
|
else if (command.action === null)
|
||||||
{
|
|
||||||
err = "E666: Internal error: command.action === null"; // TODO: need to perform this test? -- djk
|
err = "E666: Internal error: command.action === null"; // TODO: need to perform this test? -- djk
|
||||||
}
|
|
||||||
else if (count != -1 && !command.count)
|
else if (count != -1 && !command.count)
|
||||||
{
|
|
||||||
err = "E481: No range allowed";
|
err = "E481: No range allowed";
|
||||||
}
|
|
||||||
else if (special && !command.bang)
|
else if (special && !command.bang)
|
||||||
{
|
|
||||||
err = "E477: No ! allowed";
|
err = "E477: No ! allowed";
|
||||||
}
|
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
return liberator.echoerr(err);
|
return void liberator.echoerr(err);
|
||||||
if (!silent)
|
if (!silent)
|
||||||
commandline.command = str.replace(/^\s*:\s*/, "");
|
commandline.command = str.replace(/^\s*:\s*/, "");
|
||||||
command.execute(args, special, count, modifiers);
|
command.execute(args, special, count, modifiers);
|
||||||
@@ -947,9 +922,7 @@ const liberator = (function () //{{{
|
|||||||
if (item[0] == topic)
|
if (item[0] == topic)
|
||||||
return format(item);
|
return format(item);
|
||||||
else if (!partialMatch && item[0].indexOf(topic) > -1)
|
else if (!partialMatch && item[0].indexOf(topic) > -1)
|
||||||
{
|
|
||||||
partialMatch = item;
|
partialMatch = item;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (partialMatch)
|
if (partialMatch)
|
||||||
@@ -975,7 +948,7 @@ const liberator = (function () //{{{
|
|||||||
|
|
||||||
let page = this.findHelp(topic);
|
let page = this.findHelp(topic);
|
||||||
if (page == null)
|
if (page == null)
|
||||||
return liberator.echoerr("E149: Sorry, no help for " + topic);
|
return void liberator.echoerr("E149: Sorry, no help for " + topic);
|
||||||
|
|
||||||
liberator.open("chrome://liberator/locale/" + page, where);
|
liberator.open("chrome://liberator/locale/" + page, where);
|
||||||
if (where == this.CURRENT_TAB)
|
if (where == this.CURRENT_TAB)
|
||||||
@@ -991,10 +964,7 @@ const liberator = (function () //{{{
|
|||||||
function sourceDirectory(dir)
|
function sourceDirectory(dir)
|
||||||
{
|
{
|
||||||
if (!dir.isReadable())
|
if (!dir.isReadable())
|
||||||
{
|
return void liberator.echoerr("E484: Can't open file " + dir.path);
|
||||||
liberator.echoerr("E484: Can't open file " + dir.path);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
liberator.log("Sourcing plugin directory: " + dir.path + "...", 3);
|
liberator.log("Sourcing plugin directory: " + dir.path + "...", 3);
|
||||||
io.readDirectory(dir.path, true).forEach(function (file) {
|
io.readDirectory(dir.path, true).forEach(function (file) {
|
||||||
@@ -1011,9 +981,7 @@ const liberator = (function () //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (file.isDirectory())
|
else if (file.isDirectory())
|
||||||
{
|
|
||||||
sourceDirectory(file);
|
sourceDirectory(file);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -204,9 +204,7 @@ function Mappings() //{{{
|
|||||||
let [lhs, rhs] = args;
|
let [lhs, rhs] = args;
|
||||||
|
|
||||||
if (!rhs) // list the mapping
|
if (!rhs) // list the mapping
|
||||||
{
|
|
||||||
mappings.list(mode, expandLeader(lhs));
|
mappings.list(mode, expandLeader(lhs));
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (let [,m] in Iterator(mode))
|
for (let [,m] in Iterator(mode))
|
||||||
|
|||||||
@@ -214,9 +214,7 @@ Option.prototype = {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
scope = this.scope;
|
scope = this.scope;
|
||||||
}
|
|
||||||
|
|
||||||
let aValue;
|
let aValue;
|
||||||
|
|
||||||
@@ -602,25 +600,17 @@ function Options() //{{{
|
|||||||
options.setPref(name, value);
|
options.setPref(name, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
options.listPrefs(onlyNonDefault, name);
|
options.listPrefs(onlyNonDefault, name);
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let opt = options.parseOpt(arg, modifiers);
|
let opt = options.parseOpt(arg, modifiers);
|
||||||
if (!opt)
|
if (!opt)
|
||||||
{
|
return void liberator.echoerr("Error parsing :set command: " + arg);
|
||||||
liberator.echoerr("Error parsing :set command: " + arg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let option = opt.option;
|
let option = opt.option;
|
||||||
if (option == null && !opt.all)
|
if (option == null && !opt.all)
|
||||||
{
|
return void liberator.echoerr("No such option: " + opt.name);
|
||||||
liberator.echoerr("No such option: " + opt.name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// reset a variable to its default value
|
// reset a variable to its default value
|
||||||
if (opt.reset)
|
if (opt.reset)
|
||||||
@@ -631,17 +621,13 @@ function Options() //{{{
|
|||||||
option.reset();
|
option.reset();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
option.reset();
|
option.reset();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// read access
|
// read access
|
||||||
else if (opt.get)
|
else if (opt.get)
|
||||||
{
|
{
|
||||||
if (opt.all)
|
if (opt.all)
|
||||||
{
|
|
||||||
options.list(opt.onlyNonDefault, opt.scope);
|
options.list(opt.onlyNonDefault, opt.scope);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (option.type == "boolean")
|
if (option.type == "boolean")
|
||||||
@@ -658,10 +644,7 @@ function Options() //{{{
|
|||||||
if (opt.option.type == "boolean")
|
if (opt.option.type == "boolean")
|
||||||
{
|
{
|
||||||
if (opt.valueGiven)
|
if (opt.valueGiven)
|
||||||
{
|
return void liberator.echoerr("E474: Invalid argument: " + arg);
|
||||||
liberator.echoerr("E474: Invalid argument: " + arg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
opt.values = !opt.unsetBoolean;
|
opt.values = !opt.unsetBoolean;
|
||||||
}
|
}
|
||||||
let res = opt.option.op(opt.operator || "=", opt.values, opt.scope, opt.invert);
|
let res = opt.option.op(opt.operator || "=", opt.values, opt.scope, opt.invert);
|
||||||
@@ -803,17 +786,11 @@ function Options() //{{{
|
|||||||
{
|
{
|
||||||
let reference = liberator.variableReference(matches[2]);
|
let reference = liberator.variableReference(matches[2]);
|
||||||
if (!reference[0] && matches[3])
|
if (!reference[0] && matches[3])
|
||||||
{
|
return void liberator.echoerr("E121: Undefined variable: " + matches[2]);
|
||||||
liberator.echoerr("E121: Undefined variable: " + matches[2]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let expr = liberator.evalExpression(matches[4]);
|
let expr = liberator.evalExpression(matches[4]);
|
||||||
if (expr === undefined)
|
if (expr === undefined)
|
||||||
{
|
return void liberator.echoerr("E15: Invalid expression: " + matches[4]);
|
||||||
liberator.echoerr("E15: Invalid expression: " + matches[4]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!reference[0])
|
if (!reference[0])
|
||||||
@@ -843,10 +820,7 @@ function Options() //{{{
|
|||||||
{
|
{
|
||||||
let reference = liberator.variableReference(matches[1]);
|
let reference = liberator.variableReference(matches[1]);
|
||||||
if (!reference[0])
|
if (!reference[0])
|
||||||
{
|
return void liberator.echoerr("E121: Undefined variable: " + matches[1]);
|
||||||
liberator.echoerr("E121: Undefined variable: " + matches[1]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let value = reference[0][reference[1]];
|
let value = reference[0][reference[1]];
|
||||||
let prefix = typeof value == "number" ? "#" :
|
let prefix = typeof value == "number" ? "#" :
|
||||||
@@ -1117,9 +1091,7 @@ function Options() //{{{
|
|||||||
option.default = (option.default ? "" : "no") + opt.name;
|
option.default = (option.default ? "" : "no") + opt.name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
option.value = <>={template.highlight(opt.value)}</>;
|
option.value = <>={template.highlight(opt.value)}</>;
|
||||||
}
|
|
||||||
yield option;
|
yield option;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
if (scheme == "default")
|
if (scheme == "default")
|
||||||
highlight.clear();
|
highlight.clear();
|
||||||
else if (!io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"]))
|
else if (!io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"]))
|
||||||
return liberator.echoerr("E185: Cannot find color scheme " + scheme);
|
return void liberator.echoerr("E185: Cannot find color scheme " + scheme);
|
||||||
autocommands.trigger("ColorScheme", { name: scheme });
|
autocommands.trigger("ColorScheme", { name: scheme });
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -605,9 +605,7 @@ liberator.registerObserver("load_commands", function ()
|
|||||||
{
|
{
|
||||||
let compl = [];
|
let compl = [];
|
||||||
if (args.completeArg == 0)
|
if (args.completeArg == 0)
|
||||||
{
|
|
||||||
styles.completeSite(context, content);
|
styles.completeSite(context, content);
|
||||||
}
|
|
||||||
else if (args.completeArg == 1)
|
else if (args.completeArg == 1)
|
||||||
{
|
{
|
||||||
let sheet = styles.get(false, args["-name"]);
|
let sheet = styles.get(false, args["-name"]);
|
||||||
|
|||||||
@@ -129,9 +129,7 @@ function Tabs() //{{{
|
|||||||
return options["showtabline"]; // XXX
|
return options["showtabline"]; // XXX
|
||||||
|
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
{
|
|
||||||
tabStrip.collapsed = true;
|
tabStrip.collapsed = true;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
let pref = "browser.tabStrip.autoHide";
|
let pref = "browser.tabStrip.autoHide";
|
||||||
@@ -417,13 +415,9 @@ function Tabs() //{{{
|
|||||||
liberator.echoerr("E488: Trailing characters");
|
liberator.echoerr("E488: Trailing characters");
|
||||||
}
|
}
|
||||||
else if (count > 0)
|
else if (count > 0)
|
||||||
{
|
|
||||||
tabs.select("-" + count, true);
|
tabs.select("-" + count, true);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
tabs.select("-1", true);
|
tabs.select("-1", true);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: "?",
|
argCount: "?",
|
||||||
@@ -446,19 +440,12 @@ function Tabs() //{{{
|
|||||||
if (arg)
|
if (arg)
|
||||||
{
|
{
|
||||||
if (/^\d+$/.test(arg))
|
if (/^\d+$/.test(arg))
|
||||||
{
|
|
||||||
index = arg - 1;
|
index = arg - 1;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
return void liberator.echoerr("E488: Trailing characters");
|
||||||
liberator.echoerr("E488: Trailing characters");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
index = count - 1;
|
index = count - 1;
|
||||||
}
|
|
||||||
|
|
||||||
if (index < tabs.count)
|
if (index < tabs.count)
|
||||||
tabs.select(index, true);
|
tabs.select(index, true);
|
||||||
@@ -466,9 +453,7 @@ function Tabs() //{{{
|
|||||||
liberator.beep();
|
liberator.beep();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
tabs.select("+1", true);
|
tabs.select("+1", true);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: "?",
|
argCount: "?",
|
||||||
@@ -501,13 +486,9 @@ function Tabs() //{{{
|
|||||||
liberator.echoerr("E488: Trailing characters");
|
liberator.echoerr("E488: Trailing characters");
|
||||||
}
|
}
|
||||||
else if (count > 0)
|
else if (count > 0)
|
||||||
{
|
|
||||||
tabs.switchTo(count.toString(), special);
|
tabs.switchTo(count.toString(), special);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
tabs.switchTo(arg, special);
|
tabs.switchTo(arg, special);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: "?",
|
argCount: "?",
|
||||||
@@ -555,10 +536,7 @@ function Tabs() //{{{
|
|||||||
|
|
||||||
// FIXME: tabmove! N should probably produce an error
|
// FIXME: tabmove! N should probably produce an error
|
||||||
if (arg && !/^([+-]?\d+)$/.test(arg))
|
if (arg && !/^([+-]?\d+)$/.test(arg))
|
||||||
{
|
return void liberator.echoerr("E488: Trailing characters");
|
||||||
liberator.echoerr("E488: Trailing characters");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if not specified, move to after the last tab
|
// if not specified, move to after the last tab
|
||||||
tabs.move(getBrowser().mCurrentTab, arg || "$", args.bang);
|
tabs.move(getBrowser().mCurrentTab, arg || "$", args.bang);
|
||||||
@@ -647,10 +625,7 @@ function Tabs() //{{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!count)
|
if (!count)
|
||||||
{
|
return void liberator.echoerr("Exxx: No matching closed tab");
|
||||||
liberator.echoerr("Exxx: No matching closed tab");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.undoCloseTab(count - 1);
|
window.undoCloseTab(count - 1);
|
||||||
@@ -1021,9 +996,7 @@ function Tabs() //{{{
|
|||||||
getBrowser().getBrowserForTab(tab).reloadWithFlags(flags);
|
getBrowser().getBrowserForTab(tab).reloadWithFlags(flags);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
getBrowser().reloadTab(tab);
|
getBrowser().reloadTab(tab);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1050,9 +1023,7 @@ function Tabs() //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
getBrowser().reloadAllTabs();
|
getBrowser().reloadAllTabs();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1205,10 +1176,7 @@ function Tabs() //{{{
|
|||||||
selectAlternateTab: function ()
|
selectAlternateTab: function ()
|
||||||
{
|
{
|
||||||
if (tabs.alternate == null || tabs.getTab() == tabs.alternate)
|
if (tabs.alternate == null || tabs.getTab() == tabs.alternate)
|
||||||
{
|
return void liberator.echoerr("E23: No alternate page");
|
||||||
liberator.echoerr("E23: No alternate page");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: this currently relies on v.tabs.index() returning the
|
// NOTE: this currently relies on v.tabs.index() returning the
|
||||||
// currently selected tab index when passed null
|
// currently selected tab index when passed null
|
||||||
|
|||||||
@@ -714,9 +714,7 @@ function CommandLine() //{{{
|
|||||||
elements[elements.length - 1].scrollIntoView(true);
|
elements[elements.length - 1].scrollIntoView(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
win.scrollTo(0, doc.height);
|
win.scrollTo(0, doc.height);
|
||||||
}
|
|
||||||
|
|
||||||
win.focus();
|
win.focus();
|
||||||
|
|
||||||
@@ -1413,9 +1411,7 @@ function CommandLine() //{{{
|
|||||||
setTimeout(function () { multilineInputWidget.inputField.focus(); }, 0);
|
setTimeout(function () { multilineInputWidget.inputField.focus(); }, 0);
|
||||||
}
|
}
|
||||||
else if (event.type == "input")
|
else if (event.type == "input")
|
||||||
{
|
|
||||||
autosizeMultilineInputWidget();
|
autosizeMultilineInputWidget();
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1462,9 +1458,7 @@ function CommandLine() //{{{
|
|||||||
tabs.select(parseInt(event.originalTarget.parentNode.parentNode.firstChild.textContent, 10) - 1);
|
tabs.select(parseInt(event.originalTarget.parentNode.parentNode.firstChild.textContent, 10) - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
openLink(liberator.CURRENT_TAB);
|
openLink(liberator.CURRENT_TAB);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "<MiddleMouse>":
|
case "<MiddleMouse>":
|
||||||
case "<C-LeftMouse>":
|
case "<C-LeftMouse>":
|
||||||
@@ -1635,9 +1629,7 @@ function CommandLine() //{{{
|
|||||||
events.onKeyPress(event);
|
events.onKeyPress(event);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
commandline.updateMorePrompt(showMorePrompt, showMoreHelpPrompt);
|
commandline.updateMorePrompt(showMorePrompt, showMoreHelpPrompt);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getSpaceNeeded: function getSpaceNeeded()
|
getSpaceNeeded: function getSpaceNeeded()
|
||||||
@@ -2157,9 +2149,7 @@ function StatusLine() //{{{
|
|||||||
progress = "";
|
progress = "";
|
||||||
|
|
||||||
if (typeof progress == "string")
|
if (typeof progress == "string")
|
||||||
{
|
|
||||||
progressWidget.value = progress;
|
progressWidget.value = progress;
|
||||||
}
|
|
||||||
else if (typeof progress == "number")
|
else if (typeof progress == "number")
|
||||||
{
|
{
|
||||||
let progressStr = "";
|
let progressStr = "";
|
||||||
|
|||||||
@@ -100,9 +100,7 @@ function Addressbook() //{{{
|
|||||||
+ " -lastname=" + names[1].replace(/"/g, "");
|
+ " -lastname=" + names[1].replace(/"/g, "");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
displayName = "-name=\"" + displayName.replace(/"/g, "") + "\"";
|
displayName = "-name=\"" + displayName.replace(/"/g, "") + "\"";
|
||||||
}
|
|
||||||
|
|
||||||
commandline.open(":", "contact " + address + " " + displayName, modes.EX);
|
commandline.open(":", "contact " + address + " " + displayName, modes.EX);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -707,10 +707,7 @@ function Mail() //{{{
|
|||||||
|
|
||||||
// TODO: is there a better way to check for validity?
|
// TODO: is there a better way to check for validity?
|
||||||
if (addresses.some(function (recipient) !(/\S@\S+\.\S/.test(recipient))))
|
if (addresses.some(function (recipient) !(/\S@\S+\.\S/.test(recipient))))
|
||||||
{
|
return void liberator.echoerr("Exxx: Invalid e-mail address");
|
||||||
liberator.echoerr("Exxx: Invalid e-mail address");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mail.composeNewMail(mailargs);
|
mail.composeNewMail(mailargs);
|
||||||
},
|
},
|
||||||
@@ -789,10 +786,7 @@ function Mail() //{{{
|
|||||||
var url = args.attachments.pop();
|
var url = args.attachments.pop();
|
||||||
var file = io.getFile(url);
|
var file = io.getFile(url);
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
{
|
return void liberator.echoerr("Exxx: Could not attach file `" + url + "'", commandline.FORCE_SINGLELINE);
|
||||||
liberator.echoerr("Exxx: Could not attach file `" + url + "'", commandline.FORCE_SINGLELINE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"]
|
attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"]
|
||||||
.createInstance(Components.interfaces.nsIMsgAttachment);
|
.createInstance(Components.interfaces.nsIMsgAttachment);
|
||||||
|
|||||||
@@ -467,9 +467,7 @@ function Bookmarks() //{{{
|
|||||||
|
|
||||||
let count = this.remove(url);
|
let count = this.remove(url);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
|
||||||
commandline.echo("Removed bookmark: " + url, commandline.HL_NORMAL, commandline.FORCE_SINGLELINE);
|
commandline.echo("Removed bookmark: " + url, commandline.HL_NORMAL, commandline.FORCE_SINGLELINE);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
let title = buffer.title || url;
|
let title = buffer.title || url;
|
||||||
@@ -692,9 +690,7 @@ function History() //{{{
|
|||||||
let url = args.literalArg;
|
let url = args.literalArg;
|
||||||
|
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
{
|
|
||||||
history.goToStart();
|
history.goToStart();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (url)
|
if (url)
|
||||||
@@ -711,9 +707,7 @@ function History() //{{{
|
|||||||
liberator.echoerr("Exxx: URL not found in history");
|
liberator.echoerr("Exxx: URL not found in history");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
history.stepTo(-Math.max(args.count, 1));
|
history.stepTo(-Math.max(args.count, 1));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -739,9 +733,7 @@ function History() //{{{
|
|||||||
let url = args.literalArg;
|
let url = args.literalArg;
|
||||||
|
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
{
|
|
||||||
history.goToEnd();
|
history.goToEnd();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (url)
|
if (url)
|
||||||
@@ -758,9 +750,7 @@ function History() //{{{
|
|||||||
liberator.echoerr("Exxx: URL not found in history");
|
liberator.echoerr("Exxx: URL not found in history");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
history.stepTo(Math.max(args.count, 1));
|
history.stepTo(Math.max(args.count, 1));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -944,16 +934,10 @@ function QuickMarks() //{{{
|
|||||||
{
|
{
|
||||||
// TODO: finish arg parsing - we really need a proper way to do this. :)
|
// TODO: finish arg parsing - we really need a proper way to do this. :)
|
||||||
if (!args.bang && !args.string)
|
if (!args.bang && !args.string)
|
||||||
{
|
return void liberator.echoerr("E471: Argument required");
|
||||||
liberator.echoerr("E471: Argument required");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.bang && args.string)
|
if (args.bang && args.string)
|
||||||
{
|
return void liberator.echoerr("E474: Invalid argument");
|
||||||
liberator.echoerr("E474: Invalid argument");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
quickmarks.removeAll();
|
quickmarks.removeAll();
|
||||||
@@ -991,10 +975,7 @@ function QuickMarks() //{{{
|
|||||||
|
|
||||||
// ignore invalid qmark characters unless there are no valid qmark chars
|
// ignore invalid qmark characters unless there are no valid qmark chars
|
||||||
if (args && !/[a-zA-Z0-9]/.test(args))
|
if (args && !/[a-zA-Z0-9]/.test(args))
|
||||||
{
|
return void liberator.echoerr("E283: No QuickMarks matching \"" + args + "\"");
|
||||||
liberator.echoerr("E283: No QuickMarks matching \"" + args + "\"");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let filter = args.replace(/[^a-zA-Z0-9]/g, "");
|
let filter = args.replace(/[^a-zA-Z0-9]/g, "");
|
||||||
quickmarks.list(filter);
|
quickmarks.list(filter);
|
||||||
@@ -1048,19 +1029,13 @@ function QuickMarks() //{{{
|
|||||||
marks = Array.concat(lowercaseMarks, uppercaseMarks, numberMarks);
|
marks = Array.concat(lowercaseMarks, uppercaseMarks, numberMarks);
|
||||||
|
|
||||||
if (marks.length == 0)
|
if (marks.length == 0)
|
||||||
{
|
return void liberator.echoerr("No QuickMarks set");
|
||||||
liberator.echoerr("No QuickMarks set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.length > 0)
|
if (filter.length > 0)
|
||||||
{
|
{
|
||||||
marks = marks.filter(function (qmark) filter.indexOf(qmark) >= 0);
|
marks = marks.filter(function (qmark) filter.indexOf(qmark) >= 0);
|
||||||
if (marks.length == 0)
|
if (marks.length == 0)
|
||||||
{
|
return void liberator.echoerr("E283: No QuickMarks matching \"" + filter + "\"");
|
||||||
liberator.echoerr("E283: No QuickMarks matching \"" + filter + "\"");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let items = [[mark, qmarks.get(mark)] for ([k, mark] in Iterator(marks))];
|
let items = [[mark, qmarks.get(mark)] for ([k, mark] in Iterator(marks))];
|
||||||
|
|||||||
@@ -326,9 +326,7 @@ const config = { //{{{
|
|||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
if (args.string)
|
if (args.string)
|
||||||
{
|
|
||||||
liberator.open(args.string);
|
liberator.open(args.string);
|
||||||
}
|
|
||||||
else if (args.bang)
|
else if (args.bang)
|
||||||
BrowserReloadSkipCache();
|
BrowserReloadSkipCache();
|
||||||
else
|
else
|
||||||
@@ -351,9 +349,7 @@ const config = { //{{{
|
|||||||
? liberator.NEW_TAB : liberator.CURRENT_TAB);
|
? liberator.NEW_TAB : liberator.CURRENT_TAB);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
window.openPreferences();
|
window.openPreferences();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: "0",
|
argCount: "0",
|
||||||
|
|||||||
@@ -465,9 +465,7 @@ function Bookmarks() //{{{
|
|||||||
|
|
||||||
let count = this.remove(url);
|
let count = this.remove(url);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
|
||||||
commandline.echo("Removed bookmark: " + url, commandline.HL_NORMAL, commandline.FORCE_SINGLELINE);
|
commandline.echo("Removed bookmark: " + url, commandline.HL_NORMAL, commandline.FORCE_SINGLELINE);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
let title = buffer.title || url;
|
let title = buffer.title || url;
|
||||||
@@ -622,9 +620,7 @@ function Bookmarks() //{{{
|
|||||||
param = aURL.substr(offset + 1);
|
param = aURL.substr(offset + 1);
|
||||||
}
|
}
|
||||||
if (!aPostDataRef)
|
if (!aPostDataRef)
|
||||||
{
|
|
||||||
aPostDataRef = {};
|
aPostDataRef = {};
|
||||||
}
|
|
||||||
var engine = searchService.getEngineByAlias(keyword);
|
var engine = searchService.getEngineByAlias(keyword);
|
||||||
if (engine)
|
if (engine)
|
||||||
{
|
{
|
||||||
@@ -634,23 +630,17 @@ function Bookmarks() //{{{
|
|||||||
}
|
}
|
||||||
[shortcutURL, aPostDataRef.value] = PlacesUtils.getURLAndPostDataForKeyword(keyword);
|
[shortcutURL, aPostDataRef.value] = PlacesUtils.getURLAndPostDataForKeyword(keyword);
|
||||||
if (!shortcutURL)
|
if (!shortcutURL)
|
||||||
{
|
|
||||||
return aURL;
|
return aURL;
|
||||||
}
|
|
||||||
var postData = "";
|
var postData = "";
|
||||||
if (aPostDataRef.value)
|
if (aPostDataRef.value)
|
||||||
{
|
|
||||||
postData = unescape(aPostDataRef.value);
|
postData = unescape(aPostDataRef.value);
|
||||||
}
|
|
||||||
if (/%s/i.test(shortcutURL) || /%s/i.test(postData))
|
if (/%s/i.test(shortcutURL) || /%s/i.test(postData))
|
||||||
{
|
{
|
||||||
var charset = "";
|
var charset = "";
|
||||||
const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/;
|
const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/;
|
||||||
var matches = shortcutURL.match(re);
|
var matches = shortcutURL.match(re);
|
||||||
if (matches)
|
if (matches)
|
||||||
{
|
|
||||||
[, shortcutURL, charset] = matches;
|
[, shortcutURL, charset] = matches;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -660,21 +650,19 @@ function Bookmarks() //{{{
|
|||||||
}
|
}
|
||||||
var encodedParam = "";
|
var encodedParam = "";
|
||||||
if (charset)
|
if (charset)
|
||||||
{
|
|
||||||
encodedParam = escape(convertFromUnicode(charset, param));
|
encodedParam = escape(convertFromUnicode(charset, param));
|
||||||
} else {
|
else
|
||||||
encodedParam = encodeURIComponent(param);
|
encodedParam = encodeURIComponent(param);
|
||||||
}
|
|
||||||
shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param);
|
shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param);
|
||||||
if (/%s/i.test(postData))
|
if (/%s/i.test(postData))
|
||||||
{
|
|
||||||
aPostDataRef.value = getPostDataStream(postData, param, encodedParam, "application/x-www-form-urlencoded");
|
aPostDataRef.value = getPostDataStream(postData, param, encodedParam, "application/x-www-form-urlencoded");
|
||||||
}
|
}
|
||||||
} else if (param) {
|
else if (param)
|
||||||
|
{
|
||||||
aPostDataRef.value = null;
|
aPostDataRef.value = null;
|
||||||
return aURL;
|
return aURL;
|
||||||
}
|
}
|
||||||
return shortcutURL;
|
return shortcutURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
url = getShortcutOrURI(searchString, postData);
|
url = getShortcutOrURI(searchString, postData);
|
||||||
@@ -762,9 +750,7 @@ function History() //{{{
|
|||||||
let url = args.literalArg;
|
let url = args.literalArg;
|
||||||
|
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
{
|
|
||||||
history.goToStart();
|
history.goToStart();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (url)
|
if (url)
|
||||||
@@ -781,9 +767,7 @@ function History() //{{{
|
|||||||
liberator.echoerr("Exxx: URL not found in history");
|
liberator.echoerr("Exxx: URL not found in history");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
history.stepTo(-Math.max(args.count, 1));
|
history.stepTo(-Math.max(args.count, 1));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -808,9 +792,7 @@ function History() //{{{
|
|||||||
let url = args.literalArg;
|
let url = args.literalArg;
|
||||||
|
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
{
|
|
||||||
history.goToEnd();
|
history.goToEnd();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (url)
|
if (url)
|
||||||
@@ -827,9 +809,7 @@ function History() //{{{
|
|||||||
liberator.echoerr("Exxx: URL not found in history");
|
liberator.echoerr("Exxx: URL not found in history");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
history.stepTo(Math.max(args.count, 1));
|
history.stepTo(Math.max(args.count, 1));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1006,16 +986,10 @@ function QuickMarks() //{{{
|
|||||||
{
|
{
|
||||||
// TODO: finish arg parsing - we really need a proper way to do this. :)
|
// TODO: finish arg parsing - we really need a proper way to do this. :)
|
||||||
if (!args.bang && !args.string)
|
if (!args.bang && !args.string)
|
||||||
{
|
return void liberator.echoerr("E471: Argument required");
|
||||||
liberator.echoerr("E471: Argument required");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.bang && args.string)
|
if (args.bang && args.string)
|
||||||
{
|
return void liberator.echoerr("E474: Invalid argument");
|
||||||
liberator.echoerr("E474: Invalid argument");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
quickmarks.removeAll();
|
quickmarks.removeAll();
|
||||||
@@ -1053,10 +1027,7 @@ function QuickMarks() //{{{
|
|||||||
|
|
||||||
// ignore invalid qmark characters unless there are no valid qmark chars
|
// ignore invalid qmark characters unless there are no valid qmark chars
|
||||||
if (args && !/[a-zA-Z0-9]/.test(args))
|
if (args && !/[a-zA-Z0-9]/.test(args))
|
||||||
{
|
return void liberator.echoerr("E283: No QuickMarks matching \"" + args + "\"");
|
||||||
liberator.echoerr("E283: No QuickMarks matching \"" + args + "\"");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let filter = args.replace(/[^a-zA-Z0-9]/g, "");
|
let filter = args.replace(/[^a-zA-Z0-9]/g, "");
|
||||||
quickmarks.list(filter);
|
quickmarks.list(filter);
|
||||||
@@ -1110,19 +1081,13 @@ function QuickMarks() //{{{
|
|||||||
marks = Array.concat(lowercaseMarks, uppercaseMarks, numberMarks);
|
marks = Array.concat(lowercaseMarks, uppercaseMarks, numberMarks);
|
||||||
|
|
||||||
if (marks.length == 0)
|
if (marks.length == 0)
|
||||||
{
|
return void liberator.echoerr("No QuickMarks set");
|
||||||
liberator.echoerr("No QuickMarks set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.length > 0)
|
if (filter.length > 0)
|
||||||
{
|
{
|
||||||
marks = marks.filter(function (qmark) filter.indexOf(qmark) >= 0);
|
marks = marks.filter(function (qmark) filter.indexOf(qmark) >= 0);
|
||||||
if (marks.length == 0)
|
if (marks.length == 0)
|
||||||
{
|
return void liberator.echoerr("E283: No QuickMarks matching \"" + filter + "\"");
|
||||||
liberator.echoerr("E283: No QuickMarks matching \"" + filter + "\"");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let items = [[mark, qmarks.get(mark)] for ([k, mark] in Iterator(marks))];
|
let items = [[mark, qmarks.get(mark)] for ([k, mark] in Iterator(marks))];
|
||||||
|
|||||||
@@ -426,9 +426,7 @@ const config = { //{{{
|
|||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
if (args.string)
|
if (args.string)
|
||||||
{
|
|
||||||
liberator.open(args.string);
|
liberator.open(args.string);
|
||||||
}
|
|
||||||
else if (args.bang)
|
else if (args.bang)
|
||||||
BrowserReloadSkipCache();
|
BrowserReloadSkipCache();
|
||||||
else
|
else
|
||||||
@@ -451,9 +449,7 @@ const config = { //{{{
|
|||||||
? liberator.NEW_TAB : liberator.CURRENT_TAB);
|
? liberator.NEW_TAB : liberator.CURRENT_TAB);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
window.openPreferences();
|
window.openPreferences();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: "0",
|
argCount: "0",
|
||||||
|
|||||||
@@ -287,10 +287,7 @@ function Player() // {{{
|
|||||||
|
|
||||||
// intentionally supports 999:99:99
|
// intentionally supports 999:99:99
|
||||||
if (!/^[+-]?(\d+[smh]?|(\d+:\d\d:|\d+:)?\d{2})$/.test(arg))
|
if (!/^[+-]?(\d+[smh]?|(\d+:\d\d:|\d+:)?\d{2})$/.test(arg))
|
||||||
{
|
return void liberator.echoerr("E475: Invalid argument: " + arg);
|
||||||
liberator.echoerr("E475: Invalid argument: " + arg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ms(t, m) Math.abs(parseInt(t, 10) * { s: 1000, m: 60000, h: 3600000 }[m])
|
function ms(t, m) Math.abs(parseInt(t, 10) * { s: 1000, m: 60000, h: 3600000 }[m])
|
||||||
|
|
||||||
@@ -322,10 +319,7 @@ function Player() // {{{
|
|||||||
{
|
{
|
||||||
// FIXME: is this a SB restriction? --djk
|
// FIXME: is this a SB restriction? --djk
|
||||||
if (!gBrowser.currentMediaPage)
|
if (!gBrowser.currentMediaPage)
|
||||||
{
|
return void liberator.echoerr("Exxx: Can only set the media view from the media tab"); // XXX
|
||||||
liberator.echoerr("Exxx: Can only set the media view from the media tab"); // XXX
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let arg = args[0];
|
let arg = args[0];
|
||||||
|
|
||||||
@@ -401,10 +395,7 @@ function Player() // {{{
|
|||||||
let arg = args[0];
|
let arg = args[0];
|
||||||
|
|
||||||
if (!/^[+-]?\d+$/.test(arg))
|
if (!/^[+-]?\d+$/.test(arg))
|
||||||
{
|
return void liberator.echoerr("E488: Trailing characters");
|
||||||
liberator.echoerr("E488: Trailing characters");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let level = parseInt(arg, 10) / 100;
|
let level = parseInt(arg, 10) / 100;
|
||||||
|
|
||||||
@@ -602,9 +593,7 @@ function Player() // {{{
|
|||||||
focusTrack(mySearchView.getItemByIndex(lastSearchIndex));
|
focusTrack(mySearchView.getItemByIndex(lastSearchIndex));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
liberator.echoerr("E486 Pattern not found: " + searchString, commandline.FORCE_SINGLELINE);
|
liberator.echoerr("E486 Pattern not found: " + searchString, commandline.FORCE_SINGLELINE);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
searchViewAgain: function searchViewAgain(reverse)
|
searchViewAgain: function searchViewAgain(reverse)
|
||||||
@@ -683,9 +672,7 @@ function Player() // {{{
|
|||||||
{
|
{
|
||||||
// FIXME: why are there null items and duplicates?
|
// FIXME: why are there null items and duplicates?
|
||||||
if (!playlists.some(function (list) list.name == item.name) && item.name != null)
|
if (!playlists.some(function (list) list.name == item.name) && item.name != null)
|
||||||
{
|
|
||||||
playlists.push(item);
|
playlists.push(item);
|
||||||
}
|
|
||||||
return Ci.sbIMediaListEnumerationListener.CONTINUE;
|
return Ci.sbIMediaListEnumerationListener.CONTINUE;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -743,22 +730,22 @@ function Player() // {{{
|
|||||||
sortBy: function sortBy(property, order)
|
sortBy: function sortBy(property, order)
|
||||||
{
|
{
|
||||||
let pa = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"].createInstance(Ci.sbIMutablePropertyArray);
|
let pa = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"].createInstance(Ci.sbIMutablePropertyArray);
|
||||||
liberator.dump("Property: "+property);
|
liberator.dump("Property: " + property);
|
||||||
|
|
||||||
switch (property.string)
|
switch (property.string)
|
||||||
{
|
{
|
||||||
case "#":
|
case "#":
|
||||||
case "Title":
|
case "Title":
|
||||||
pa.appendProperty(SBProperties.trackName, 'a');
|
pa.appendProperty(SBProperties.trackName, "a");
|
||||||
break;
|
break;
|
||||||
case "Rating":
|
case "Rating":
|
||||||
pa.appendProperty(SBProperties.rating, 1);
|
pa.appendProperty(SBProperties.rating, 1);
|
||||||
break;
|
break;
|
||||||
case "Album":
|
case "Album":
|
||||||
pa.appendProperty(SBProperties.albumName, 'a');
|
pa.appendProperty(SBProperties.albumName, "a");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pa.appendProperty(SBProperties.trackName, 'a');
|
pa.appendProperty(SBProperties.trackName, "a");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user