mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 18:57:58 +01:00
Fix :noremap. (Probably) Fixes issue #168.
This commit is contained in:
@@ -354,11 +354,8 @@ const Mappings = Module("mappings", {
|
|||||||
}, {
|
}, {
|
||||||
commands: function () {
|
commands: function () {
|
||||||
function addMapCommands(ch, mapmodes, modeDescription) {
|
function addMapCommands(ch, mapmodes, modeDescription) {
|
||||||
// 0 args -> list all maps
|
function map(args, noremap) {
|
||||||
// 1 arg -> list the maps starting with args
|
let mapmodes = array.uniq(args["-modes"].map(findMode));
|
||||||
// 2 args -> map arg1 to arg*
|
|
||||||
function map(args, mapmodes, noremap) {
|
|
||||||
mapmodes = getModes(args);
|
|
||||||
if (!args.length) {
|
if (!args.length) {
|
||||||
mappings.list(mapmodes);
|
mappings.list(mapmodes);
|
||||||
return;
|
return;
|
||||||
@@ -386,23 +383,14 @@ const Mappings = Module("mappings", {
|
|||||||
|
|
||||||
modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";
|
modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";
|
||||||
|
|
||||||
// :map, :noremap => NORMAL + VISUAL modes
|
|
||||||
function isMultiMode(map, cmd) {
|
|
||||||
return map.modes.indexOf(modules.modes.NORMAL) >= 0
|
|
||||||
&& map.modes.indexOf(modules.modes.VISUAL) >= 0
|
|
||||||
&& /^[nv](nore)?map$/.test(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
function findMode(name) {
|
function findMode(name) {
|
||||||
if (typeof name == "number")
|
if (isinstance(name, Number))
|
||||||
return name;
|
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.char || name == mode.name.toLowerCase())
|
||||||
return mode.mask;
|
return mode.mask;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
function getModes(args)
|
|
||||||
array.uniq(args["-modes"].map(findMode));
|
|
||||||
function uniqueModes(modes) {
|
function uniqueModes(modes) {
|
||||||
modes = modes.map(modules.modes.closure.getMode);
|
modes = modes.map(modules.modes.closure.getMode);
|
||||||
let chars = [k for ([k, v] in Iterator(modules.modes.modeChars))
|
let chars = [k for ([k, v] in Iterator(modules.modes.modeChars))
|
||||||
@@ -492,12 +480,12 @@ const Mappings = Module("mappings", {
|
|||||||
|
|
||||||
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, mapmodes, false); },
|
function (args) { map(args, false); },
|
||||||
opts);
|
opts);
|
||||||
|
|
||||||
commands.add([ch + "no[remap]"],
|
commands.add([ch + "no[remap]"],
|
||||||
"Map a key sequence without remapping keys" + modeDescription,
|
"Map a key sequence without remapping keys" + modeDescription,
|
||||||
function (args) { map(args, mapmodes, true); },
|
function (args) { map(args, true); },
|
||||||
opts);
|
opts);
|
||||||
|
|
||||||
commands.add([ch + "mapc[lear]"],
|
commands.add([ch + "mapc[lear]"],
|
||||||
|
|||||||
@@ -134,6 +134,9 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
|||||||
*/
|
*/
|
||||||
compareIgnoreCase: function compareIgnoreCase(a, b) String.localeCompare(a.toLowerCase(), b.toLowerCase()),
|
compareIgnoreCase: function compareIgnoreCase(a, b) String.localeCompare(a.toLowerCase(), b.toLowerCase()),
|
||||||
|
|
||||||
|
compileFormat: function compileFormat(format) {
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an object representing a Node's computed CSS style.
|
* Returns an object representing a Node's computed CSS style.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user