diff --git a/common/content/io.js b/common/content/io.js
index 0502cb24..00342081 100644
--- a/common/content/io.js
+++ b/common/content/io.js
@@ -342,7 +342,7 @@ lookup:
this.withSavedValues(["sourcing"], function () {
this.sourcing = null;
try {
- var file = io.File(util.getFile(filename) || filename);
+ var file = util.getFile(filename) || io.File(filename);
if (!file.exists() || !file.isReadable() || file.isDirectory()) {
if (!silent)
diff --git a/common/content/options.js b/common/content/options.js
index 54a97f11..99e6d51f 100644
--- a/common/content/options.js
+++ b/common/content/options.js
@@ -223,11 +223,11 @@ const Option = Class("Option", {
*/
op: function (operator, values, scope, invert, str) {
- let newValues = this._op(operator, values, scope, invert);
- if (newValues == null)
- return "Operator " + operator + " not supported for option type " + this.type;
-
try {
+ var newValues = this._op(operator, values, scope, invert);
+ if (newValues == null)
+ return "Operator " + operator + " not supported for option type " + this.type;
+
if (!this.isValidValue(newValues))
return this.invalidArgument(str || this.stringify(values), operator);
}
@@ -489,9 +489,11 @@ const Option = Class("Option", {
},
number: function (operator, values, scope, invert) {
- // TODO: support floats? Validators need updating.
- if (!/^[+-]?(?:0x[0-9a-f]+|0[0-7]*|[1-9][0-9]*)$/i.test(values))
- return "E521: Number required after := " + this.name + "=" + values;
+ if (invert)
+ values = values[(values.indexOf(String(this.value)) + 1) % values.length]
+
+ dactyl.assert(!isNaN(values) && Number(values) == parseInt(values),
+ "E521: Number required after := " + this.name + "=" + values);
let value = parseInt(values);
@@ -561,6 +563,8 @@ const Option = Class("Option", {
get regexpmap() this.stringlist,
string: function (operator, values, scope, invert) {
+ if (invert)
+ return values[(values.indexOf(this.value) + 1) % values.length]
switch (operator) {
case "+":
return this.value + values;
@@ -907,10 +911,12 @@ const Options = Module("options", {
}
// write access
else {
- if (opt.option.type == "boolean") {
+ if (opt.option.type === "boolean") {
dactyl.assert(!opt.valueGiven, "E474: Invalid argument: " + arg);
opt.values = !opt.unsetBoolean;
}
+ else if (/^(string|number)$/.test(opt.option.type) && opt.invert)
+ opt.values = Option.splitList(opt.value);
try {
var res = opt.option.op(opt.operator || "=", opt.values, opt.scope, opt.invert,
opt.value);
diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml
index bb2e8153..d9d24776 100644
--- a/common/locale/en-US/options.xml
+++ b/common/locale/en-US/options.xml
@@ -404,19 +404,17 @@
- To enable auto-completion for everything but
- To go in the other direction, i.e. only enable
- auto-completion for those commands, you have to jump through
- some hoops, due to the way contexts work (see the note above):
-
+ To go in the other direction, i.e. only enable
+ auto-completion for those commands, you have to jump through
+ some hoops, due to the way contexts work (see the note above):
+