mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 00:17:58 +01:00
Block invalid keys in VISUAL TEXT EDIT mode and add v_x mapping. Closes issue #182.
This commit is contained in:
@@ -678,11 +678,10 @@ const Editor = Module("editor", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
mappings.add([modes.VISUAL],
|
mappings.add([modes.VISUAL],
|
||||||
["d"], "Delete selected text",
|
["d", "x"], "Delete selected text",
|
||||||
function () {
|
function () {
|
||||||
dactyl.assert(editor.isTextEdit);
|
dactyl.assert(editor.isTextEdit);
|
||||||
editor.executeCommand("cmd_cut");
|
editor.executeCommand("cmd_cut");
|
||||||
modes.pop();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mappings.add([modes.VISUAL],
|
mappings.add([modes.VISUAL],
|
||||||
|
|||||||
@@ -969,7 +969,7 @@ const Events = Module("events", {
|
|||||||
this._input.motionCount = null;
|
this._input.motionCount = null;
|
||||||
|
|
||||||
if (!isEscape(key)) {
|
if (!isEscape(key)) {
|
||||||
stop = (mode.main == modes.TEXT_EDIT);
|
stop = (mode.main & (modes.TEXT_EDIT | modes.VISUAL));
|
||||||
if (stop)
|
if (stop)
|
||||||
dactyl.beep();
|
dactyl.beep();
|
||||||
|
|
||||||
|
|||||||
@@ -373,21 +373,17 @@ const Mappings = Module("mappings", {
|
|||||||
Command.bindMacro(args, "-keys", ["count"]),
|
Command.bindMacro(args, "-keys", ["count"]),
|
||||||
{
|
{
|
||||||
count: args["-count"],
|
count: args["-count"],
|
||||||
noremap: "-builtin" in args,
|
noremap: args["-builtin"],
|
||||||
persist: !args["-nopersist"],
|
persist: !args["-nopersist"],
|
||||||
get rhs() String(this.action),
|
get rhs() String(this.action),
|
||||||
silent: "-silent" in args
|
silent: args["-silent"]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";
|
|
||||||
|
|
||||||
function findMode(name) {
|
function findMode(name) {
|
||||||
if (isinstance(name, Number))
|
|
||||||
return name;
|
|
||||||
for (let mode in modes.mainModes)
|
for (let mode in modes.mainModes)
|
||||||
if (name == mode.char || name == mode.name.toLowerCase())
|
if (name == mode || name == mode.char || String.toLowerCase(name).replace(/-/g, "_") == mode.name.toLowerCase())
|
||||||
return mode.mask;
|
return mode.mask;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -439,7 +435,7 @@ const Mappings = Module("mappings", {
|
|||||||
description: "Create this mapping in the given modes",
|
description: "Create this mapping in the given modes",
|
||||||
default: mapmodes || ["n", "v"],
|
default: mapmodes || ["n", "v"],
|
||||||
validator: function (list) !list || list.every(findMode),
|
validator: function (list) !list || list.every(findMode),
|
||||||
completer: function () [[array.compact([mode.name.toLowerCase(), mode.char]), mode.disp]
|
completer: function () [[array.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.disp]
|
||||||
for (mode in modes.mainModes)],
|
for (mode in modes.mainModes)],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -478,6 +474,7 @@ const Mappings = Module("mappings", {
|
|||||||
yield map;
|
yield map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";
|
||||||
commands.add([ch ? ch + "m[ap]" : "map"],
|
commands.add([ch ? ch + "m[ap]" : "map"],
|
||||||
"Map a key sequence" + modeDescription,
|
"Map a key sequence" + modeDescription,
|
||||||
function (args) { map(args, false); },
|
function (args) { map(args, false); },
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ const Modes = Module("modes", {
|
|||||||
disp: disp,
|
disp: disp,
|
||||||
extended: extended,
|
extended: extended,
|
||||||
input: false,
|
input: false,
|
||||||
mask: this[name],
|
mask: mode,
|
||||||
name: name,
|
name: name,
|
||||||
params: params || {}
|
params: params || {}
|
||||||
}, options);
|
}, options);
|
||||||
|
|||||||
Reference in New Issue
Block a user