summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2011-04-05 19:45:33 -0400
committerKris Maglione <maglione.k@gmail.com>2011-04-05 19:45:33 -0400
commit5f141d26bd3e5bf66aa2d2eb2a9335547d081859 (patch)
tree3c54080317bdd1ea46ebffd1df6febc525cdd8d7 /common
parent3a9069f24d1a956ead1b0620c20288d62b7f2433 (diff)
downloadpentadactyl-5f141d26bd3e5bf66aa2d2eb2a9335547d081859.tar.gz
Fix some issues with ops on *map options.
Diffstat (limited to 'common')
-rw-r--r--common/modules/options.jsm17
1 files changed, 11 insertions, 6 deletions
diff --git a/common/modules/options.jsm b/common/modules/options.jsm
index e002703c..2c024a51 100644
--- a/common/modules/options.jsm
+++ b/common/modules/options.jsm
@@ -619,19 +619,24 @@ var Option = Class("Option", {
stringlist: function stringlist(operator, values, scope, invert) {
values = Array.concat(values);
+ function uniq(ary) {
+ let seen = {};
+ return ary.filter(function (elem) !set.add(seen, elem));
+ }
+
switch (operator) {
case "+":
- return array.uniq(Array.concat(this.value, values), true);
+ return uniq(Array.concat(this.value, values), true);
case "^":
// NOTE: Vim doesn't prepend if there's a match in the current value
- return array.uniq(Array.concat(values, this.value), true);
+ return uniq(Array.concat(values, this.value), true);
case "-":
- return this.value.filter(function (item) values.indexOf(item) == -1);
+ return this.value.filter(function (item) !set.has(this, item), set(values));
case "=":
if (invert) {
- let keepValues = this.value.filter(function (item) values.indexOf(item) == -1);
- let addValues = values.filter(function (item) this.value.indexOf(item) == -1, this);
- return addValues.concat(keepValues);
+ let keepValues = this.value.filter(function (item) !set.has(this, item), set(values));
+ let addValues = values.filter(function (item) !set.has(this, item), set(this.value));
+ return this.parse(addValues.concat(keepValues));
}
return values;
}