summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Kearns <dougkearns@gmail.com>2009-05-22 02:36:35 +1000
committerDoug Kearns <dougkearns@gmail.com>2009-05-22 10:53:17 +1000
commit26dabbfd0daa8116b88bdec8f6c96dc3fc255b15 (patch)
tree3cee49ce5b30e2ce49c624bc8b783620a35fb9d1
parent4c4295029e574d08403dfde92679937e52750423 (diff)
downloadpentadactyl-26dabbfd0daa8116b88bdec8f6c96dc3fc255b15.tar.gz
Change multiline error message guard clauses to single line formatting.
Also apply similar formattng fixes to conditional blocks as per standard.
-rw-r--r--common/content/buffer.js58
-rw-r--r--common/content/commands.js17
-rw-r--r--common/content/editor.js13
-rw-r--r--common/content/events.js47
-rw-r--r--common/content/finder.js2
-rw-r--r--common/content/hints.js6
-rw-r--r--common/content/io.js36
-rw-r--r--common/content/liberator.js46
-rw-r--r--common/content/mappings.js2
-rw-r--r--common/content/options.js40
-rw-r--r--common/content/style.js4
-rw-r--r--common/content/tabs.js40
-rw-r--r--common/content/ui.js10
-rw-r--r--muttator/content/addressbook.js2
-rw-r--r--muttator/content/mail.js10
-rw-r--r--vimperator/content/bookmarks.js35
-rw-r--r--vimperator/content/config.js4
-rw-r--r--xulmus/content/bookmarks.js55
-rw-r--r--xulmus/content/config.js4
-rw-r--r--xulmus/content/player.js39
20 files changed, 70 insertions, 400 deletions
diff --git a/common/content/buffer.js b/common/content/buffer.js
index f4bfeff0..1074be81 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -59,10 +59,7 @@ function Buffer() //{{{
function setZoom(value, fullZoom)
{
if (value < ZOOM_MIN || value > ZOOM_MAX)
- {
- liberator.echoerr("Zoom value out of range (" + ZOOM_MIN + " - " + ZOOM_MAX + "%)");
- return;
- }
+ return void liberator.echoerr("Zoom value out of range (" + ZOOM_MIN + " - " + ZOOM_MAX + "%)");
ZoomManager.useFullZoom = fullZoom;
ZoomManager.zoom = value / 100;
@@ -533,7 +530,7 @@ function Buffer() //{{{
// FIXME: arg handling is a bit of a mess, check for filename
if (arg && (liberator.has("Win32") || arg[0] != ">"))
- return liberator.echoerr("E488: Trailing characters");
+ return void liberator.echoerr("E488: Trailing characters");
options.withContext(function () {
if (arg)
@@ -543,9 +540,7 @@ function Buffer() //{{{
liberator.echomsg("Printing to file: " + arg.substr(1));
}
else
- {
liberator.echomsg("Sending to printer...");
- }
options.setPref("print.always_print_silent", 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);
if (arg && titles.indexOf(arg) == -1)
- {
- liberator.echoerr("E475: Invalid argument: " + arg);
- return;
- }
+ return void liberator.echoerr("E475: Invalid argument: " + arg);
if (options["usermode"])
options["usermode"] = false;
@@ -673,13 +665,9 @@ function Buffer() //{{{
let level;
if (!arg)
- {
level = 100;
- }
else if (/^\d+$/.test(arg))
- {
level = parseInt(arg, 10);
- }
else if (/^[+-]\d+$/.test(arg))
{
if (args.bang)
@@ -694,10 +682,7 @@ function Buffer() //{{{
level = ZOOM_MAX;
}
else
- {
- liberator.echoerr("E488: Trailing characters");
- return;
- }
+ return void liberator.echoerr("E488: Trailing characters");
if (args.bang)
buffer.fullZoom = level;
@@ -1735,15 +1720,9 @@ function Marks() //{{{
args = args.string;
if (!special && !args)
- {
- liberator.echoerr("E471: Argument required");
- return;
- }
+ return void liberator.echoerr("E471: Argument required");
if (special && args)
- {
- liberator.echoerr("E474: Invalid argument");
- return;
- }
+ return void liberator.echoerr("E474: Invalid argument");
let matches;
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];
if (mark.length > 1)
- {
- liberator.echoerr("E488: Trailing characters");
- return;
- }
+ return void liberator.echoerr("E488: Trailing characters");
if (!/[a-zA-Z]/.test(mark))
- {
- liberator.echoerr("E191: Argument must be a letter or forward/backward quote");
- return;
- }
+ return void liberator.echoerr("E191: Argument must be a letter or forward/backward quote");
marks.add(mark);
},
@@ -1806,10 +1779,7 @@ function Marks() //{{{
// ignore invalid mark characters unless there are no valid mark chars
if (args && !/[a-zA-Z]/.test(args))
- {
- liberator.echoerr("E283: No marks matching " + args.quote());
- return;
- }
+ return void liberator.echoerr("E283: No marks matching " + args.quote());
let filter = args.replace(/[^a-zA-Z]/g, "");
marks.list(filter);
@@ -1973,19 +1943,13 @@ function Marks() //{{{
let marks = getSortedMarks();
if (marks.length == 0)
- {
- liberator.echoerr("No marks set");
- return;
- }
+ return void liberator.echoerr("No marks set");
if (filter.length > 0)
{
marks = marks.filter(function (mark) filter.indexOf(mark[0]) >= 0);
if (marks.length == 0)
- {
- liberator.echoerr("E283: No marks matching " + filter.quote());
- return;
- }
+ return void liberator.echoerr("E283: No marks matching " + filter.quote());
}
let list = template.tabular(["mark", "line", "col", "file"],
diff --git a/common/content/commands.js b/common/content/commands.js
index 8c1ee93e..e431b356 100644
--- a/common/content/commands.js
+++ b/common/content/commands.js
@@ -375,9 +375,7 @@ function Commands() //{{{
if (exCommands.some(function (c) c.hasName(command.name)))
{
if (isUserCommand && replace)
- {
commands.removeUserCommand(command.name);
- }
else
{
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));
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 (sep != "=" && !quote && arg.length == 0)
@@ -725,9 +723,7 @@ function Commands() //{{{
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
- {
invalid = true;
- }
let context = null;
if (!complete && quote)
@@ -807,7 +803,7 @@ function Commands() //{{{
// if not an option, treat this token as an argument
let [count, arg, quote, error] = getNextArg(sub);
if (error)
- return liberator.echoerr(error);
+ return void liberator.echoerr(error);
if (complete)
{
@@ -997,10 +993,7 @@ function Commands() //{{{
let cmd = args[0];
if (cmd != null && /\W/.test(cmd))
- {
- liberator.echoerr("E182: Invalid command name");
- return;
- }
+ return void liberator.echoerr("E182: Invalid command name");
if (args.literalArg)
{
@@ -1036,9 +1029,7 @@ function Commands() //{{{
}
}
else
- {
completeFunc = completion[completeOptionMap[completeOpt]];
- }
}
let added = commands.addUserCommand([cmd],
@@ -1083,9 +1074,7 @@ function Commands() //{{{
commandline.echo(str, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
}
else
- {
liberator.echomsg("No user-defined commands found");
- }
}
},
{
diff --git a/common/content/editor.js b/common/content/editor.js
index d6570788..2dd1a1cc 100644
--- a/common/content/editor.js
+++ b/common/content/editor.js
@@ -537,13 +537,9 @@ function Editor() //{{{
function (count)
{
if (modes.main == modes.VISUAL)
- {
count = getEditor().selectionEnd - getEditor().selectionStart;
- }
if (typeof count != "number" || count < 1)
- {
count = 1;
- }
while (count-- > 0)
{
@@ -867,10 +863,7 @@ function Editor() //{{{
let args = commands.parseArgs(options["editor"], [], "*", true);
if (args.length < 1)
- {
- liberator.echoerr("No editor specified");
- return;
- }
+ return void liberator.echoerr("No editor specified");
args.push(path);
liberator.callFunctionInThread(null, io.run, io.expandPath(args.shift()), args, true);
@@ -1038,9 +1031,7 @@ function Editor() //{{{
return;
}
else
- {
return;
- }
}
}
}
@@ -1125,9 +1116,7 @@ function Editor() //{{{
let list = this.getAbbreviations(filter, lhs);
if (!list.length)
- {
liberator.echomsg("No abbreviations found");
- }
else if (list.length == 1)
{
let [mode, lhs, rhs] = list[0];
diff --git a/common/content/events.js b/common/content/events.js
index e8502eff..c3064e4b 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -80,10 +80,7 @@ function AutoCommands() //{{{
events = event.split(",");
if (!events.every(function (event) validEvents.indexOf(event) >= 0))
- {
- liberator.echoerr("E216: No such group or event: " + event);
- return;
- }
+ return void liberator.echoerr("E216: No such group or event: " + event);
}
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
}
else
- {
autocommands.list(event, regex); // list all
- }
}
},
{
@@ -146,13 +141,9 @@ function AutoCommands() //{{{
let validEvents = config.autocommands.map(function (e) e[0]);
if (event == "*")
- {
liberator.echoerr("E217: Can't execute autocommands for ALL events");
- }
else if (validEvents.indexOf(event) == -1)
- {
liberator.echoerr("E216: No such group or event: " + args);
- }
else
{
// TODO: perhaps trigger could return the number of autocmds triggered
@@ -314,9 +305,7 @@ function AutoCommands() //{{{
}
}
else
- {
liberator.execute(commands.replaceTokens(autoCmd.command, args), null, true);
- }
}
}
}
@@ -603,9 +592,7 @@ function Events() //{{{
}
}
else // background tab
- {
liberator.echomsg("Background tab loaded: " + title || url, 3);
- }
triggerLoadAutocmd("PageLoad", doc);
}
@@ -663,9 +650,7 @@ function Events() //{{{
}
}
else
- {
liberator.log("No user macros directory found", 3);
- }
}
catch (e)
{
@@ -733,10 +718,7 @@ function Events() //{{{
function (args)
{
if (args.bang && args.string)
- {
- liberator.echoerr("E474: Invalid argument");
- return;
- }
+ return void liberator.echoerr("E474: Invalid argument");
if (args.bang)
events.deleteMacros();
@@ -811,11 +793,8 @@ function Events() //{{{
startRecording: function (macro)
{
if (!/[a-zA-Z0-9]/.test(macro))
- {
// TODO: ignore this like Vim?
- liberator.echoerr("E354: Invalid register name: '" + macro + "'");
- return;
- }
+ return void liberator.echoerr("E354: Invalid register name: '" + macro + "'");
modes.isRecording = true;
@@ -981,21 +960,13 @@ function Events() //{{{
charCode = keyname.charCodeAt(0);
}
else if (keyname.toLowerCase() == "space")
- {
charCode = 32;
- }
else if (keyname.toLowerCase() == "nop")
- {
string = "<Nop>";
- }
else if (keyCode = getKeyCode(keyname))
- {
charCode = 0;
- }
else // an invalid key like <A-xxx> was found, stop propagation here (like Vim)
- {
break;
- }
i += match.length - 1;
}
@@ -1020,9 +991,7 @@ function Events() //{{{
events.onKeyPress(evt);
}
else
- {
elem.dispatchEvent(evt);
- }
if (!this.feedingKeys)
break;
// stop feeding keys if page loading failed
@@ -1120,9 +1089,7 @@ function Events() //{{{
modifier = modifier.replace("C-", "");
}
else // [Ctrl-Bug 2,3,4,5/5] the <C-\\>, <C-]>, <C-^>, <C-_> bugs
- {
key = String.fromCharCode(event.charCode + 64);
- }
}
// special handling of the Space key
else if (event.charCode == 32)
@@ -1310,9 +1277,7 @@ function Events() //{{{
}, 0);
}
else
- {
modes.reset();
- }
}
}
finally
@@ -1422,9 +1387,7 @@ function Events() //{{{
return true;
}
else if (!mappings.hasMap(liberator.mode, input.buffer + key))
- {
macros.set(currentMacro, macros.get(currentMacro) + key);
- }
}
if (key == "<C-c>")
@@ -1606,9 +1569,7 @@ function Events() //{{{
else if (input.pendingMotionMap)
{
if (key != "<Esc>" && key != "<C-[>")
- {
input.pendingMotionMap.execute(candidateCommand, input.count, null);
- }
input.pendingMotionMap = null;
input.buffer = "";
inputBufferLength = 0;
@@ -1671,9 +1632,7 @@ function Events() //{{{
commandline.onEvent(event); // reroute event in command line mode
}
else if (liberator.mode != modes.INSERT && liberator.mode != modes.TEXTAREA)
- {
liberator.beep();
- }
}
}
diff --git a/common/content/finder.js b/common/content/finder.js
index d9874ffd..33494d49 100644
--- a/common/content/finder.js
+++ b/common/content/finder.js
@@ -409,9 +409,7 @@ function Finder() //{{{
let result = getBrowser().fastFind.findAgain(up, linksOnly);
if (result == Ci.nsITypeAheadFind.FIND_NOTFOUND)
- {
liberator.echoerr("E486: Pattern not found: " + lastSearchPattern, commandline.FORCE_SINGLELINE);
- }
else if (result == Ci.nsITypeAheadFind.FIND_WRAPPED)
{
// hack needed, because wrapping causes a "scroll" event which clears
diff --git a/common/content/hints.js b/common/content/hints.js
index 1083ab3e..0689d3ea 100644
--- a/common/content/hints.js
+++ b/common/content/hints.js
@@ -260,9 +260,7 @@ function Hints() //{{{
// If we found a satisfactory offset, let's use it.
if (curdist < Infinity)
- {
return [leftpos + curleft, toppos + curtop]
- }
}
}
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);
if (tagname == "area")
- {
[leftpos, toppos] = getAreaOffset(elem, leftpos, toppos);
- }
span.style.left = leftpos + "px";
span.style.top = toppos + "px";
@@ -532,9 +528,7 @@ function Hints() //{{{
return false;
}
else if (validHints.length > 1)
- {
return false;
- }
}
let timeout = followFirst || events.feedingKeys ? 0 : 500;
diff --git a/common/content/io.js b/common/content/io.js
index 31700ae8..46f99f51 100644
--- a/common/content/io.js
+++ b/common/content/io.js
@@ -206,20 +206,13 @@ function IO() //{{{
let arg = args.literalArg;
if (!arg)
- {
arg = "~";
- }
else if (arg == "-")
{
if (oldcwd)
- {
arg = oldcwd.path;
- }
else
- {
- liberator.echoerr("E186: No previous directory");
- return;
- }
+ return void liberator.echoerr("E186: No previous directory");
}
arg = io.expandPath(arg);
@@ -280,19 +273,13 @@ function IO() //{{{
function (args)
{
if (args.length > 1)
- {
- liberator.echoerr("E172: Only one file name allowed");
- return;
- }
+ return void liberator.echoerr("E172: Only one file name allowed");
let filename = args[0] || io.getRCFile(null, true).path;
let file = io.getFile(filename);
if (file.exists() && !args.bang)
- {
- liberator.echoerr("E189: \"" + filename + "\" exists (add ! to override)");
- return;
- }
+ return void liberator.echoerr("E189: \"" + filename + "\" exists (add ! to override)");
// TODO: Use a set/specifiable list here:
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?
if (/((^|[^\\])(\\\\)*)!/.test(arg) && !lastRunCommand)
- {
- liberator.echoerr("E34: No previous command");
- return;
- }
+ return void liberator.echoerr("E34: No previous command");
// 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
@@ -527,9 +511,7 @@ function IO() //{{{
newDir = newDir || "~";
if (newDir == "-")
- {
[cwd, oldcwd] = [oldcwd, this.getCurrentDirectory()];
- }
else
{
let dir = self.getFile(newDir);
@@ -820,9 +802,7 @@ function IO() //{{{
let file;
if (isAbsolutePath(program))
- {
file = self.getFile(program, true);
- }
else
{
let dirs = services.get("environment").get("PATH").split(WINDOWS ? ";" : ":");
@@ -968,9 +948,7 @@ lookup:
}
}
else if (/\.css$/.test(filename))
- {
storage.styles.registerSheet(uri.spec, true);
- }
else
{
let heredoc = "";
@@ -988,9 +966,7 @@ lookup:
heredocEnd = null;
}
else
- {
heredoc += line + "\n";
- }
}
else
{
@@ -1018,9 +994,7 @@ lookup:
else
{
if (command.name == "finish")
- {
break;
- }
else if (command.hereDoc)
{
// check for a heredoc
@@ -1034,9 +1008,7 @@ lookup:
heredoc = matches[1] + "\n";
}
else
- {
command.execute(args, special, count);
- }
}
else
{
diff --git a/common/content/liberator.js b/common/content/liberator.js
index 548720f6..3e354e3d 100644
--- a/common/content/liberator.js
+++ b/common/content/liberator.js
@@ -299,10 +299,7 @@ const liberator = (function () //{{{
let items = getMenuItems();
if (!items.some(function (i) i.fullMenuPath == arg))
- {
- liberator.echoerr("E334: Menu not found: " + arg);
- return;
- }
+ return void liberator.echoerr("E334: Menu not found: " + arg);
for (let [,item] in Iterator(items))
{
@@ -333,7 +330,6 @@ const liberator = (function () //{{{
catch (e)
{
liberator.echoerr(e);
- return;
}
});
@@ -350,10 +346,7 @@ const liberator = (function () //{{{
function (args)
{
if (args.bang)
- {
- liberator.echoerr("E478: Don't panic!");
- return;
- }
+ return void liberator.echoerr("E478: Don't panic!");
liberator.help(args.literalArg);
},
@@ -480,9 +473,7 @@ const liberator = (function () //{{{
totalUnits = "sec";
}
else
- {
totalUnits = "msec";
- }
let str = template.commandOutput(
<table>
@@ -811,10 +802,7 @@ const liberator = (function () //{{{
let opt = this.options.get(matches[1]);
if (!opt)
- {
- this.echoerr("E113: Unknown option: " + matches[1]);
- return;
- }
+ return void this.echoerr("E113: Unknown option: " + matches[1]);
let type = opt.type;
let value = opt.getter();
@@ -829,21 +817,14 @@ const liberator = (function () //{{{
else if (matches = string.match(/^(['"])([^\1]*?[^\\]?)\1/))
{
if (matches)
- {
return matches[2].toString();
- }
else
- {
- this.echoerr("E115: Missing quote: " + string);
- return;
- }
+ return void this.echoerr("E115: Missing quote: " + string);
}
// Number
else if (matches = string.match(/^(\d+)$/))
- {
return parseInt(matches[1], 10);
- }
let reference = this.variableReference(string);
@@ -874,20 +855,14 @@ const liberator = (function () //{{{
liberator.focusContent();
}
else if (command.action === null)
- {
err = "E666: Internal error: command.action === null"; // TODO: need to perform this test? -- djk
- }
else if (count != -1 && !command.count)
- {
err = "E481: No range allowed";
- }
else if (special && !command.bang)
- {
err = "E477: No ! allowed";
- }
if (err)
- return liberator.echoerr(err);
+ return void liberator.echoerr(err);
if (!silent)
commandline.command = str.replace(/^\s*:\s*/, "");
command.execute(args, special, count, modifiers);
@@ -947,9 +922,7 @@ const liberator = (function () //{{{
if (item[0] == topic)
return format(item);
else if (!partialMatch && item[0].indexOf(topic) > -1)
- {
partialMatch = item;
- }
}
if (partialMatch)
@@ -975,7 +948,7 @@ const liberator = (function () //{{{
let page = this.findHelp(topic);
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);
if (where == this.CURRENT_TAB)
@@ -991,10 +964,7 @@ const liberator = (function () //{{{
function sourceDirectory(dir)
{
if (!dir.isReadable())
- {
- liberator.echoerr("E484: Can't open file " + dir.path);
- return;
- }
+ return void liberator.echoerr("E484: Can't open file " + dir.path);
liberator.log("Sourcing plugin directory: " + dir.path + "...", 3);
io.readDirectory(dir.path, true).forEach(function (file) {
@@ -1011,9 +981,7 @@ const liberator = (function () //{{{
}
}
else if (file.isDirectory())
- {
sourceDirectory(file);
- }
});
}
diff --git a/common/content/mappings.js b/common/content/mappings.js
index c7c4fabe..bf90742e 100644
--- a/common/content/mappings.js
+++ b/common/content/mappings.js
@@ -204,9 +204,7 @@ function Mappings() //{{{
let [lhs, rhs] = args;
if (!rhs) // list the mapping
- {
mappings.list(mode, expandLeader(lhs));
- }
else
{
for (let [,m] in Iterator(mode))
diff --git a/common/content/options.js b/common/content/options.js
index 4a352ab1..dba3a29c 100644
--- a/common/content/options.js
+++ b/common/content/options.js
@@ -214,9 +214,7 @@ Option.prototype = {
return null;
}
else
- {
scope = this.scope;
- }
let aValue;
@@ -602,25 +600,17 @@ function Options() //{{{
options.setPref(name, value);
}
else
- {
options.listPrefs(onlyNonDefault, name);
- }
return;
}
let opt = options.parseOpt(arg, modifiers);
if (!opt)
- {
- liberator.echoerr("Error parsing :set command: " + arg);
- return;
- }
+ return void liberator.echoerr("Error parsing :set command: " + arg);
let option = opt.option;
if (option == null && !opt.all)
- {
- liberator.echoerr("No such option: " + opt.name);
- return;
- }
+ return void liberator.echoerr("No such option: " + opt.name);
// reset a variable to its default value
if (opt.reset)
@@ -631,17 +621,13 @@ function Options() //{{{
option.reset();
}
else
- {
option.reset();
- }
}
// read access
else if (opt.get)
{
if (opt.all)
- {
options.list(opt.onlyNonDefault, opt.scope);
- }
else
{
if (option.type == "boolean")
@@ -658,10 +644,7 @@ function Options() //{{{
if (opt.option.type == "boolean")
{
if (opt.valueGiven)
- {
- liberator.echoerr("E474: Invalid argument: " + arg);
- return;
- }
+ return void liberator.echoerr("E474: Invalid argument: " + arg);
opt.values = !opt.unsetBoolean;
}
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]);
if (!reference[0] && matches[3])
- {
- liberator.echoerr("E121: Undefined variable: " + matches[2]);
- return;
- }
+ return void liberator.echoerr("E121: Undefined variable: " + matches[2]);
let expr = liberator.evalExpression(matches[4]);
if (expr === undefined)
- {
- liberator.echoerr("E15: Invalid expression: " + matches[4]);
- return;
- }
+ return void liberator.echoerr("E15: Invalid expression: " + matches[4]);
else
{
if (!reference[0])
@@ -843,10 +820,7 @@ function Options() //{{{
{
let reference = liberator.variableReference(matches[1]);
if (!reference[0])
- {
- liberator.echoerr("E121: Undefined variable: " + matches[1]);
- return;
- }
+ return void liberator.echoerr("E121: Undefined variable: " + matches[1]);
let value = reference[0][reference[1]];
let prefix = typeof value == "number" ? "#" :
@@ -1117,9 +1091,7 @@ function Options() //{{{
option.default = (option.default ? "" : "no") + opt.name;
}
else
- {
option.value = <>={template.highlight(opt.value)}</>;
- }
yield option;
}
};
diff --git a/common/content/style.js b/common/content/style.js
index 0db9da25..b8477c0f 100644
--- a/common/content/style.js
+++ b/common/content/style.js
@@ -557,7 +557,7 @@ liberator.registerObserver("load_commands", function ()
if (scheme == "default")
highlight.clear();
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 });
},
{
@@ -605,9 +605,7 @@ liberator.registerObserver("load_commands", function ()
{
let compl = [];
if (args.completeArg == 0)
- {
styles.completeSite(context, content);
- }
else if (args.completeArg == 1)
{
let sheet = styles.get(false, args["-name"]);
diff --git a/common/content/tabs.js b/common/content/tabs.js
index 2ca99ba3..fabf9b0c 100644
--- a/common/content/tabs.js
+++ b/common/content/tabs.js
@@ -129,9 +129,7 @@ function Tabs() //{{{
return options["showtabline"]; // XXX
if (value == 0)
- {
tabStrip.collapsed = true;
- }
else
{
let pref = "browser.tabStrip.autoHide";
@@ -417,13 +415,9 @@ function Tabs() //{{{
liberator.echoerr("E488: Trailing characters");
}
else if (count > 0)
- {
tabs.select("-" + count, true);
- }
else
- {
tabs.select("-1", true);
- }
},
{
argCount: "?",
@@ -446,19 +440,12 @@ function Tabs() //{{{
if (arg)
{
if (/^\d+$/.test(arg))
- {
index = arg - 1;
- }
else
- {
- liberator.echoerr("E488: Trailing characters");
- return;
- }
+ return void liberator.echoerr("E488: Trailing characters");
}
else
- {
index = count - 1;
- }
if (index < tabs.count)
tabs.select(index, true);
@@ -466,9 +453,7 @@ function Tabs() //{{{
liberator.beep();
}
else
- {
tabs.select("+1", true);
- }
},
{
argCount: "?",
@@ -501,13 +486,9 @@ function Tabs() //{{{
liberator.echoerr("E488: Trailing characters");
}
else if (count > 0)
- {
tabs.switchTo(count.toString(), special);
- }
else
- {
tabs.switchTo(arg, special);
- }
},
{
argCount: "?",
@@ -555,10 +536,7 @@ function Tabs() //{{{
// FIXME: tabmove! N should probably produce an error
if (arg && !/^([+-]?\d+)$/.test(arg))
- {
- liberator.echoerr("E488: Trailing characters");
- return;
- }
+ return void liberator.echoerr("E488: Trailing characters");
// if not specified, move to after the last tab
tabs.move(getBrowser().mCurrentTab, arg || "$", args.bang);
@@ -647,10 +625,7 @@ function Tabs() //{{{
}
if (!count)
- {
- liberator.echoerr("Exxx: No matching closed tab");
- return;
- }
+ return void liberator.echoerr("Exxx: No matching closed tab");
}
window.undoCloseTab(count - 1);
@@ -1021,9 +996,7 @@ function Tabs() //{{{
getBrowser().getBrowserForTab(tab).reloadWithFlags(flags);
}
else
- {
getBrowser().reloadTab(tab);
- }
},
/**
@@ -1050,9 +1023,7 @@ function Tabs() //{{{
}
}
else
- {
getBrowser().reloadAllTabs();
- }
},
/**
@@ -1205,10 +1176,7 @@ function Tabs() //{{{
selectAlternateTab: function ()
{
if (tabs.alternate == null || tabs.getTab() == tabs.alternate)
- {
- liberator.echoerr("E23: No alternate page");
- return;
- }
+ return void liberator.echoerr("E23: No alternate page");
// NOTE: this currently relies on v.tabs.index() returning the
// currently selected tab index when passed null
diff --git a/common/content/ui.js b/common/content/ui.js
index 52357f99..1da69d11 100644
--- a/common/content/ui.js
+++ b/common/content/ui.js
@@ -714,9 +714,7 @@ function CommandLine() //{{{
elements[elements.length - 1].scrollIntoView(true);
}
else
- {
win.scrollTo(0, doc.height);
- }
win.focus();
@@ -1413,9 +1411,7 @@ function CommandLine() //{{{
setTimeout(function () { multilineInputWidget.inputField.focus(); }, 0);
}
else if (event.type == "input")
- {
autosizeMultilineInputWidget();
- }
return true;
},
@@ -1462,9 +1458,7 @@ function CommandLine() //{{{
tabs.select(parseInt(event.originalTarget.parentNode.parentNode.firstChild.textContent, 10) - 1);
}
else
- {
openLink(liberator.CURRENT_TAB);
- }
break;
case "<MiddleMouse>":
case "<C-LeftMouse>":
@@ -1635,9 +1629,7 @@ function CommandLine() //{{{
events.onKeyPress(event);
}
else
- {
commandline.updateMorePrompt(showMorePrompt, showMoreHelpPrompt);
- }
},
getSpaceNeeded: function getSpaceNeeded()
@@ -2157,9 +2149,7 @@ function StatusLine() //{{{
progress = "";
if (typeof progress == "string")
- {
progressWidget.value = progress;
- }
else if (typeof progress == "number")
{
let progressStr = "";
diff --git a/muttator/content/addressbook.js b/muttator/content/addressbook.js
index ee1a4a74..7dbfe74e 100644
--- a/muttator/content/addressbook.js
+++ b/muttator/content/addressbook.js
@@ -100,9 +100,7 @@ function Addressbook() //{{{
+ " -lastname=" + names[1].replace(/"/g, "");
}
else
- {
displayName = "-name=\"" + displayName.replace(/"/g, "") + "\"";
- }
commandline.open(":", "contact " + address + " " + displayName, modes.EX);
});
diff --git a/muttator/content/mail.js b/muttator/content/mail.js
index 7f93316b..2a5fdc5c 100644
--- a/muttator/content/mail.js
+++ b/muttator/content/mail.js
@@ -707,10 +707,7 @@ function Mail() //{{{
// TODO: is there a better way to check for validity?
if (addresses.some(function (recipient) !(/\S@\S+\.\S/.test(recipient))))
- {
- liberator.echoerr("Exxx: Invalid e-mail address");
- return;
- }
+ return void liberator.echoerr("Exxx: Invalid e-mail address");
mail.composeNewMail(mailargs);
},
@@ -789,10 +786,7 @@ function Mail() //{{{
var url = args.attachments.pop();
var file = io.getFile(url);
if (!file.exists())
- {
- liberator.echoerr("Exxx: Could not attach file `" + url + "'", commandline.FORCE_SINGLELINE);
- return;
- }
+ return void liberator.echoerr("Exxx: Could not attach file `" + url + "'", commandline.FORCE_SINGLELINE);
attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"]
.createInstance(Components.interfaces.nsIMsgAttachment);
diff --git a/vimperator/content/bookmarks.js b/vimperator/content/bookmarks.js
index dcf9cbb1..6fca9451 100644
--- a/vimperator/content/bookmarks.js
+++ b/vimperator/content/bookmarks.js
@@ -467,9 +467,7 @@ function Bookmarks() //{{{
let count = this.remove(url);
if (count > 0)
- {
commandline.echo("Removed bookmark: " + url, commandline.HL_NORMAL, commandline.FORCE_SINGLELINE);
- }
else
{
let title = buffer.title || url;
@@ -692,9 +690,7 @@ function History() //{{{
let url = args.literalArg;
if (args.bang)
- {
history.goToStart();
- }
else
{
if (url)
@@ -711,9 +707,7 @@ function History() //{{{
liberator.echoerr("Exxx: URL not found in history");
}
else
- {
history.stepTo(-Math.max(args.count, 1));
- }
}
},
{
@@ -739,9 +733,7 @@ function History() //{{{
let url = args.literalArg;
if (args.bang)
- {
history.goToEnd();
- }
else
{
if (url)
@@ -758,9 +750,7 @@ function History() //{{{
liberator.echoerr("Exxx: URL not found in history");
}
else
- {
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. :)
if (!args.bang && !args.string)
- {
- liberator.echoerr("E471: Argument required");
- return;
- }
+ return void liberator.echoerr("E471: Argument required");
if (args.bang && args.string)
- {
- liberator.echoerr("E474: Invalid argument");
- return;
- }
+ return void liberator.echoerr("E474: Invalid argument");
if (args.bang)
quickmarks.removeAll();
@@ -991,10 +975,7 @@ function QuickMarks() //{{{
// ignore invalid qmark characters unless there are no valid qmark chars
if (args && !/[a-zA-Z0-9]/.test(args))
- {
- liberator.echoerr("E283: No QuickMarks matching \"" + args + "\"");
- return;
- }
+ return void liberator.echoerr("E283: No QuickMarks matching \"" + args + "\"");
let filter = args.replace(/[^a-zA-Z0-9]/g, "");
quickmarks.list(filter);
@@ -1048,19 +1029,13 @@ function QuickMarks() //{{{
marks = Array.concat(lowercaseMarks, uppercaseMarks, numberMarks);
if (marks.length == 0)
- {
- liberator.echoerr("No QuickMarks set");
- return;
- }
+ return void liberator.echoerr("No QuickMarks set");
if (filter.length > 0)
{
marks = marks.filter(function (qmark) filter.indexOf(qmark) >= 0);
if (marks.length == 0)
- {
- liberator.echoerr("E283: No QuickMarks matching \"" + filter + "\"");
- return;
- }
+ return void liberator.echoerr("E283: No QuickMarks matching \"" + filter + "\"");
}
let items = [[mark, qmarks.get(mark)] for ([k, mark] in Iterator(marks))];
diff --git a/vimperator/content/config.js b/vimperator/content/config.js
index 91956be8..88e585f2 100644
--- a/vimperator/content/config.js
+++ b/vimperator/content/config.js
@@ -326,9 +326,7 @@ const config = { //{{{
function (args)
{
if (args.string)
- {
liberator.open(args.string);
- }
else if (args.bang)
BrowserReloadSkipCache();
else
@@ -351,9 +349,7 @@ const config = { //{{{
? liberator.NEW_TAB : liberator.CURRENT_TAB);
}
else
- {
window.openPreferences();
- }
},
{
argCount: "0",
diff --git a/xulmus/content/bookmarks.js b/xulmus/content/bookmarks.js
index 4daf5530..aa5975d9 100644
--- a/xulmus/content/bookmarks.js
+++ b/xulmus/content/bookmarks.js
@@ -465,9 +465,7 @@ function Bookmarks() //{{{
let count = this.remove(url);
if (count > 0)
- {
commandline.echo("Removed bookmark: " + url, commandline.HL_NORMAL, commandline.FORCE_SINGLELINE);
- }
else
{
let title = buffer.title || url;
@@ -622,9 +620,7 @@ function Bookmarks() //{{{
param = aURL.substr(offset + 1);
}
if (!aPostDataRef)
- {
aPostDataRef = {};
- }
var engine = searchService.getEngineByAlias(keyword);
if (engine)
{
@@ -634,23 +630,17 @@ function Bookmarks() //{{{
}
[shortcutURL, aPostDataRef.value] = PlacesUtils.getURLAndPostDataForKeyword(keyword);
if (!shortcutURL)
- {
return aURL;
- }
var postData = "";
if (aPostDataRef.value)
- {
postData = unescape(aPostDataRef.value);
- }
if (/%s/i.test(shortcutURL) || /%s/i.test(postData))
{
var charset = "";
const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/;
var matches = shortcutURL.match(re);
if (matches)
- {
[, shortcutURL, charset] = matches;
- }
else
{
try
@@ -660,21 +650,19 @@ function Bookmarks() //{{{
}
var encodedParam = "";
if (charset)
- {
encodedParam = escape(convertFromUnicode(charset, param));
- } else {
+ else
encodedParam = encodeURIComponent(param);
- }
shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param);
if (/%s/i.test(postData))
- {
aPostDataRef.value = getPostDataStream(postData, param, encodedParam, "application/x-www-form-urlencoded");
- }
- } else if (param) {
+ }
+ else if (param)
+ {
aPostDataRef.value = null;
return aURL;
}
- return shortcutURL;
+ return shortcutURL;
}
url = getShortcutOrURI(searchString, postData);
@@ -762,9 +750,7 @@ function History() //{{{
let url = args.literalArg;
if (args.bang)
- {
history.goToStart();
- }
else
{
if (url)
@@ -781,9 +767,7 @@ function History() //{{{
liberator.echoerr("Exxx: URL not found in history");
}
else
- {
history.stepTo(-Math.max(args.count, 1));
- }
}
},
{
@@ -808,9 +792,7 @@ function History() //{{{
let url = args.literalArg;
if (args.bang)
- {
history.goToEnd();
- }
else
{
if (url)
@@ -827,9 +809,7 @@ function History() //{{{
liberator.echoerr("Exxx: URL not found in history");
}
else
- {
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. :)
if (!args.bang && !args.string)
- {
- liberator.echoerr("E471: Argument required");
- return;
- }
+ return void liberator.echoerr("E471: Argument required");
if (args.bang && args.string)
- {
- liberator.echoerr("E474: Invalid argument");
- return;
- }
+ return void liberator.echoerr("E474: Invalid argument");
if (args.bang)
quickmarks.removeAll();
@@ -1053,10 +1027,7 @@ function QuickMarks() //{{{
// ignore invalid qmark characters unless there are no valid qmark chars
if (args && !/[a-zA-Z0-9]/.test(args))
- {
- liberator.echoerr("E283: No QuickMarks matching \"" + args + "\"");
- return;
- }
+ return void liberator.echoerr("E283: No QuickMarks matching \"" + args + "\"");
let filter = args.replace(/[^a-zA-Z0-9]/g, "");
quickmarks.list(filter);
@@ -1110,19 +1081,13 @@ function QuickMarks() //{{{
marks = Array.concat(lowercaseMarks, uppercaseMarks, numberMarks);
if (marks.length == 0)
- {
- liberator.echoerr("No QuickMarks set");
- return;
- }
+ return void liberator.echoerr("No QuickMarks set");
if (filter.length > 0)
{
marks = marks.filter(function (qmark) filter.indexOf(qmark) >= 0);
if (marks.length == 0)
- {
- liberator.echoerr("E283: No QuickMarks matching \"" + filter + "\"");
- return;
- }
+ return void liberator.echoerr("E283: No QuickMarks matching \"" + filter + "\"");
}
let items = [[mark, qmarks.get(mark)] for ([k, mark] in Iterator(marks))];
diff --git a/xulmus/content/config.js b/xulmus/content/config.js
index 8f2ea42f..f9533205 100644
--- a/xulmus/content/config.js
+++ b/xulmus/content/config.js
@@ -426,9 +426,7 @@ const config = { //{{{
function (args)
{
if (args.string)
- {
liberator.open(args.string);
- }
else if (args.bang)
BrowserReloadSkipCache();
else
@@ -451,9 +449,7 @@ const config = { //{{{
? liberator.NEW_TAB : liberator.CURRENT_TAB);
}
else
- {
window.openPreferences();
- }
},
{
argCount: "0",
diff --git a/xulmus/content/player.js b/xulmus/content/player.js
index 8ac15801..999b14f7 100644
--- a/xulmus/content/player.js
+++ b/xulmus/content/player.js
@@ -13,7 +13,7 @@ function Player() // {{{
services.add("mediaPageManager", "@songbirdnest.com/Songbird/MediaPageManager;1", Ci.sbIMediaPageManager);
services.add("propertyManager","@songbirdnest.com/Songbird/Properties/PropertyManager;1", Ci.sbIPropertyManager);
-
+
// Register Callbacks for searching.
liberator.registerCallback("change", modes.SEARCH_VIEW_FORWARD, function (str) { player.onSearchKeyPress(str); });
liberator.registerCallback("submit", modes.SEARCH_VIEW_FORWARD, function (str) { player.onSearchSubmit(str); });
@@ -287,10 +287,7 @@ function Player() // {{{
// intentionally supports 999:99:99
if (!/^[+-]?(\d+[smh]?|(\d+:\d\d:|\d+:)?\d{2})$/.test(arg))
- {
- liberator.echoerr("E475: Invalid argument: " + arg);
- return;
- }
+ return void liberator.echoerr("E475: Invalid argument: " + arg);
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
if (!gBrowser.currentMediaPage)
- {
- liberator.echoerr("Exxx: Can only set the media view from the media tab"); // XXX
- return;
- }
+ return void liberator.echoerr("Exxx: Can only set the media view from the media tab"); // XXX
let arg = args[0];
@@ -401,10 +395,7 @@ function Player() // {{{
let arg = args[0];
if (!/^[+-]?\d+$/.test(arg))
- {
- liberator.echoerr("E488: Trailing characters");
- return;
- }
+ return void liberator.echoerr("E488: Trailing characters");
let level = parseInt(arg, 10) / 100;
@@ -602,9 +593,7 @@ function Player() // {{{
focusTrack(mySearchView.getItemByIndex(lastSearchIndex));
}
else
- {
liberator.echoerr("E486 Pattern not found: " + searchString, commandline.FORCE_SINGLELINE);
- }
},
searchViewAgain: function searchViewAgain(reverse)
@@ -683,9 +672,7 @@ function Player() // {{{
{
// FIXME: why are there null items and duplicates?
if (!playlists.some(function (list) list.name == item.name) && item.name != null)
- {
playlists.push(item);
- }
return Ci.sbIMediaListEnumerationListener.CONTINUE;
}
};
@@ -735,34 +722,34 @@ function Player() // {{{
liberator.dump("PropertyID - "+propManager.getPropertyInfo(propertyID).id);
properties.push(propManager.getPropertyInfo(propertyID).displayName);
}
- }
-
+ }
+
return properties;
},
sortBy: function sortBy(property, order)
{
let pa = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"].createInstance(Ci.sbIMutablePropertyArray);
- liberator.dump("Property: "+property);
-
+ liberator.dump("Property: " + property);
+
switch (property.string)
{
case "#":
case "Title":
- pa.appendProperty(SBProperties.trackName, 'a');
+ pa.appendProperty(SBProperties.trackName, "a");
break;
case "Rating":
pa.appendProperty(SBProperties.rating, 1);
break;
case "Album":
- pa.appendProperty(SBProperties.albumName, 'a');
+ pa.appendProperty(SBProperties.albumName, "a");
break;
default:
- pa.appendProperty(SBProperties.trackName, 'a');
+ pa.appendProperty(SBProperties.trackName, "a");
break;
}
-
- _SBGetCurrentView().setSort(pa);
+
+ _SBGetCurrentView().setSort(pa);
}
};