diff options
Diffstat (limited to 'common/content/mappings.js')
-rw-r--r-- | common/content/mappings.js | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/common/content/mappings.js b/common/content/mappings.js index 1db6f5f3..6108edd3 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -59,18 +59,30 @@ function Map(modes, keys, description, action, extraInfo) //{{{ this.names = keys.map(events.canonicalKeys); /** @property {function (number)} The function called to execute this mapping. */ this.action = action; - - /** @property {number} @see Mappings#flags */ - // FIXME: flags is incongruent with the other properties - this.flags = extraInfo.flags || 0; /** @property {string} This mapping's description, as shown in :viusage. */ this.description = description || ""; - /** @property {string} The literal RHS expansion of this mapping. */ - this.rhs = extraInfo.rhs || null; + + /** @property {boolean} Whether this mapping accepts an argument. */ + this.arg = extraInfo.arg || false; + /** @property {boolean} Whether this mapping accepts a count. */ + this.count = extraInfo.count || false; + /** + * @property {boolean} Whether the mapping accepts a motion mapping + * as an argument. + */ + this.motion = extraInfo.motion || false; + /** + * @property {boolean} Whether the mapping's key events should be + * propagated to the host application. + */ + // TODO: I'm not sure this is the best name but it reflects that which it replaced. --djk + this.route = extraInfo.route || false; /** @property {boolean} Whether the RHS of the mapping should expand mappings recursively. */ this.noremap = extraInfo.noremap || false; /** @property {boolean} Whether any output from the mapping should be echoed on the command line. */ this.silent = extraInfo.silent || false; + /** @property {string} The literal RHS expansion of this mapping. */ + this.rhs = extraInfo.rhs || null; } Map.prototype = { @@ -98,11 +110,11 @@ Map.prototype = { { let args = []; - if (this.flags & Mappings.flags.MOTION) + if (this.motion) args.push(motion); - if (this.flags & Mappings.flags.COUNT) + if (this.count) args.push(count); - if (this.flags & Mappings.flags.ARGUMENT) + if (this.arg) args.push(argument); let self = this; @@ -213,7 +225,7 @@ function Mappings() //{{{ "User defined mapping", function (count) { events.feedkeys((count > -1 ? count : "") + this.rhs, this.noremap, this.silent); }, { - flags: Mappings.flags.COUNT, + count: true, rhs: events.canonicalKeys(rhs), noremap: !!noremap, silent: "<silent>" in args @@ -334,14 +346,6 @@ function Mappings() //{{{ ]); }); - // FIXME: - Mappings.flags = { - ALLOW_EVENT_ROUTING: 1 << 0, // if set, return true inside the map command to pass the event further to Firefox - MOTION: 1 << 1, - COUNT: 1 << 2, - ARGUMENT: 1 << 3 - }; - return { // NOTE: just normal mode for now |