mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-22 06:35:44 +01:00
Split Map.flags into individual properties of Map.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user