mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 22:47:59 +01:00
Better handling of operations on list options with complex types. Closes #37.
This commit is contained in:
@@ -682,7 +682,6 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
context.format = history.format;
|
context.format = history.format;
|
||||||
context.title = [/*L*/keyword + " Quick Search"];
|
context.title = [/*L*/keyword + " Quick Search"];
|
||||||
context.keys = { text: "url", description: "title", icon: "icon" };
|
context.keys = { text: "url", description: "title", icon: "icon" };
|
||||||
// context.background = true;
|
|
||||||
context.compare = CompletionContext.Sort.unsorted;
|
context.compare = CompletionContext.Sort.unsorted;
|
||||||
context.generate = function () {
|
context.generate = function () {
|
||||||
let [begin, end] = item.url.split("%s");
|
let [begin, end] = item.url.split("%s");
|
||||||
|
|||||||
@@ -394,11 +394,12 @@ var CommandMode = Class("CommandMode", {
|
|||||||
|
|
||||||
commandline.hideCompletions();
|
commandline.hideCompletions();
|
||||||
|
|
||||||
|
let result = this.command;
|
||||||
modes.delay(function () {
|
modes.delay(function () {
|
||||||
if (!this.keepCommand || commandline.silent || commandline.quiet)
|
if (!this.keepCommand || commandline.silent || commandline.quiet)
|
||||||
commandline.hide();
|
commandline.hide();
|
||||||
if (!waiting)
|
if (!waiting)
|
||||||
this[this.accepted ? "onSubmit" : "onCancel"](commandline.command);
|
this[this.accepted ? "onSubmit" : "onCancel"](result);
|
||||||
if (commandline.messageCount === this.messageCount)
|
if (commandline.messageCount === this.messageCount)
|
||||||
commandline.clearMessage();
|
commandline.clearMessage();
|
||||||
}, this);
|
}, this);
|
||||||
|
|||||||
@@ -953,7 +953,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
|
|
||||||
// decide where to load the first url
|
// decide where to load the first url
|
||||||
switch (where) {
|
switch (where) {
|
||||||
|
|
||||||
case dactyl.NEW_TAB:
|
case dactyl.NEW_TAB:
|
||||||
if (!dactyl.has("tabs"))
|
if (!dactyl.has("tabs"))
|
||||||
return open(loc, dactyl.NEW_WINDOW);
|
return open(loc, dactyl.NEW_WINDOW);
|
||||||
|
|||||||
@@ -705,9 +705,13 @@ var Option = Class("Option", {
|
|||||||
return this.value.filter(function (item) !this.has(item), new RealSet(values));
|
return this.value.filter(function (item) !this.has(item), new RealSet(values));
|
||||||
case "=":
|
case "=":
|
||||||
if (invert) {
|
if (invert) {
|
||||||
let keepValues = this.value.filter(function (item) !this.has(item), new RealSet(values));
|
let old = this.value.map(String);
|
||||||
let addValues = values.filter(function (item) !this.has(item), new RealSet(this.value));
|
let new_ = values.map(String);
|
||||||
return addValues.concat(keepValues);
|
let map = Ary(this.value).concat(values).map(val => [String(val), val]).toObject();
|
||||||
|
|
||||||
|
let keepValues = old.filter(function (item) !this.has(item), new RealSet(new_));
|
||||||
|
let addValues = new_.filter(function (item) !this.has(item), new RealSet(old));
|
||||||
|
return addValues.concat(keepValues).map(s => map[s]);
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,13 @@ var Promises = Module("Promises", {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the passed object is a promise.
|
||||||
|
*/
|
||||||
|
isPromise: function isPromise(obj) {
|
||||||
|
return isObject(obj) && typeof obj.then === "function";
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a promise which resolves after the given number of
|
* Returns a promise which resolves after the given number of
|
||||||
* milliseconds.
|
* milliseconds.
|
||||||
|
|||||||
Reference in New Issue
Block a user