diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-09-28 21:05:23 -0400 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-09-28 21:05:23 -0400 |
commit | 1104d4a186facd5ee74de23607344633d81d8cad (patch) | |
tree | 0caa390ca2ed04da6c6e19e86d929d8c241f13bc /common/modules | |
parent | 117baf311fa236ead861058853c280e3750ec166 (diff) | |
download | pentadactyl-1104d4a186facd5ee74de23607344633d81d8cad.tar.gz |
Fix :set number!=...
Diffstat (limited to 'common/modules')
-rw-r--r-- | common/modules/options.jsm | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/common/modules/options.jsm b/common/modules/options.jsm index ec08d861..8547a13c 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -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,7 +1006,8 @@ var Options = Module("options", { res.optionValue = res.option.get(res.scope); try { - res.values = res.option.parse(res.value); + if (!res.invert || res.option.type != "number") // Hack. + res.values = res.option.parse(res.value); } catch (e) { res.error = e; |