1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 13:47:59 +01:00

Fix :set number!=...

This commit is contained in:
Kris Maglione
2011-09-28 21:05:23 -04:00
parent 117baf311f
commit 1104d4a186
2 changed files with 22 additions and 19 deletions

View File

@@ -2288,7 +2288,8 @@ var Buffer = Module("buffer", {
setter: function setter(value) {
prefs.set(this.PREF, value > 1);
return value > 1 ? value : this.globalValue;
if (value > 1)
return value;
},
validator: function (value) value > 0

View File

@@ -600,6 +600,23 @@ var Option = Class("Option", {
return null;
},
string: function string(operator, values, scope, invert) {
if (invert)
return values[(values.indexOf(this.value) + 1) % values.length];
switch (operator) {
case "+":
return this.value + values;
case "-":
return this.value.replace(values, "");
case "^":
return values + this.value;
case "=":
return values;
}
return null;
},
stringmap: function stringmap(operator, values, scope, invert) {
let res = update({}, this.value);
@@ -657,23 +674,7 @@ var Option = Class("Option", {
get regexplist() this.stringlist,
get regexpmap() this.stringlist,
get sitelist() this.stringlist,
get sitemap() this.stringlist,
string: function string(operator, values, scope, invert) {
if (invert)
return values[(values.indexOf(this.value) + 1) % values.length];
switch (operator) {
case "+":
return this.value + values;
case "-":
return this.value.replace(values, "");
case "^":
return values + this.value;
case "=":
return values;
}
return null;
}
get sitemap() this.stringlist
},
validIf: function validIf(test, error) {
@@ -1005,6 +1006,7 @@ var Options = Module("options", {
res.optionValue = res.option.get(res.scope);
try {
if (!res.invert || res.option.type != "number") // Hack.
res.values = res.option.parse(res.value);
}
catch (e) {