mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 17:47:59 +01:00
Fix a bug in replacing user commands. Closes issue #88.
--HG-- extra : rebase_source : 3d5045b548a81ec70e43ab1e3d006a975f95b974
This commit is contained in:
@@ -663,7 +663,8 @@ const CommandLine = Module("commandline", {
|
||||
this._echoMultiline(<span highlight="Message">{this._lastEcho}</span>,
|
||||
this.widgets.message[0], true);
|
||||
|
||||
if (action === this._echoLine && !(flags & this.FORCE_MULTILINE) && !this.widgets.mowContainer.collapsed) {
|
||||
if (action === this._echoLine && !(flags & this.FORCE_MULTILINE)
|
||||
&& !(dactyl.fullyInitialized && this.widgets.mowContainer.collapsed)) {
|
||||
highlightGroup += " Message";
|
||||
action = this._echoMultiline;
|
||||
}
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
|
||||
/** @scope modules */
|
||||
|
||||
// Do NOT create instances of this class yourself, use the helper method
|
||||
// commands.add() instead
|
||||
|
||||
/**
|
||||
* A structure representing the options available for a command.
|
||||
*
|
||||
* Do NOT create instances of this class yourself, use the helper method
|
||||
* {@see Commands#add} instead
|
||||
*
|
||||
* @property {[string]} names An array of option names. The first name
|
||||
* is the canonical option name.
|
||||
* @property {number} type The option's value type. This is one of:
|
||||
@@ -334,7 +335,7 @@ const Commands = Module("commands", {
|
||||
_addCommand: function (args, replace) {
|
||||
let names = array.flatten(Command.parseSpecs(args[0]));
|
||||
dactyl.assert(!names.some(function (name) name in this._exMap && !this._exMap[name].user, this),
|
||||
"E182: Can't replace non-user command: " + args[0]);
|
||||
"E182: Can't replace non-user command: " + args[0][0]);
|
||||
if (!replace || !(args[3] && args[3].user))
|
||||
dactyl.assert(!names.some(function (name) name in this._exMap, this),
|
||||
"Not replacing command " + args[0]);
|
||||
@@ -937,9 +938,9 @@ const Commands = Module("commands", {
|
||||
removeUserCommand: function (name) {
|
||||
let cmd = this.get(name);
|
||||
dactyl.assert(cmd.user, "E184: No such user-defined command: " + name);
|
||||
for (let name in array.iterValues(cmd.names))
|
||||
this._exCommands = this._exCommands.filter(function (c) c !== cmd);
|
||||
for (let name in values(cmd.names))
|
||||
delete this._exMap[name];
|
||||
this._exCommands = this._exCommands.filter(function (c) c != cmd);
|
||||
},
|
||||
|
||||
// FIXME: still belong here? Also used for autocommand parameters.
|
||||
|
||||
@@ -2045,6 +2045,7 @@ const Dactyl = Module("dactyl", {
|
||||
dactyl.execute(cmd);
|
||||
});
|
||||
|
||||
dactyl.fullyInitialized = true;
|
||||
dactyl.triggerObserver("enter", null);
|
||||
autocommands.trigger("Enter", {});
|
||||
}, 0);
|
||||
|
||||
@@ -443,7 +443,7 @@ const Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakR
|
||||
services.get("permissions").remove(uri, "cookie");
|
||||
services.get("permissions").add(uri, "cookie", Sanitizer.PERMS[perm]);
|
||||
}
|
||||
commands.addUserCommand(["cookies", "ck"],
|
||||
commands.add(["cookies", "ck"],
|
||||
"Change cookie permissions for sites.",
|
||||
function (args) {
|
||||
let host = args.shift();
|
||||
@@ -497,7 +497,7 @@ const Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakR
|
||||
break;
|
||||
}
|
||||
},
|
||||
}, true);
|
||||
});
|
||||
},
|
||||
completion: function (dactyl, modules, window) {
|
||||
modules.completion.visibleHosts = function completeHosts(context) {
|
||||
|
||||
Reference in New Issue
Block a user