mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-23 07:45:47 +01:00
Fix some issues with ops on *map options.
This commit is contained in:
@@ -619,19 +619,24 @@ var Option = Class("Option", {
|
|||||||
stringlist: function stringlist(operator, values, scope, invert) {
|
stringlist: function stringlist(operator, values, scope, invert) {
|
||||||
values = Array.concat(values);
|
values = Array.concat(values);
|
||||||
|
|
||||||
|
function uniq(ary) {
|
||||||
|
let seen = {};
|
||||||
|
return ary.filter(function (elem) !set.add(seen, elem));
|
||||||
|
}
|
||||||
|
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case "+":
|
case "+":
|
||||||
return array.uniq(Array.concat(this.value, values), true);
|
return uniq(Array.concat(this.value, values), true);
|
||||||
case "^":
|
case "^":
|
||||||
// NOTE: Vim doesn't prepend if there's a match in the current value
|
// 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 "-":
|
case "-":
|
||||||
return this.value.filter(function (item) values.indexOf(item) == -1);
|
return this.value.filter(function (item) !set.has(this, item), set(values));
|
||||||
case "=":
|
case "=":
|
||||||
if (invert) {
|
if (invert) {
|
||||||
let keepValues = this.value.filter(function (item) values.indexOf(item) == -1);
|
let keepValues = this.value.filter(function (item) !set.has(this, item), set(values));
|
||||||
let addValues = values.filter(function (item) this.value.indexOf(item) == -1, this);
|
let addValues = values.filter(function (item) !set.has(this, item), set(this.value));
|
||||||
return addValues.concat(keepValues);
|
return this.parse(addValues.concat(keepValues));
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user