1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 20:57:59 +01:00

Fix confusing, duplicate help index entries.

This commit is contained in:
Kris Maglione
2011-02-22 03:00:50 -05:00
parent 28ec383432
commit 572f36906b
5 changed files with 24 additions and 9 deletions

View File

@@ -252,7 +252,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
dactyl.open(homepages, { from: "homepage", where: dactyl.NEW_TAB }); dactyl.open(homepages, { from: "homepage", where: dactyl.NEW_TAB });
}); });
mappings.add(modes.all, ["<C-l>"], mappings.add([modes.MAIN], ["<C-l>"],
"Redraw the screen", "Redraw the screen",
function () { ex.redraw(); }); function () { ex.redraw(); });
}, },

View File

@@ -1676,11 +1676,11 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
}, },
mappings: function () { mappings: function () {
mappings.add(modes.all, ["<F1>"], mappings.add([modes.MAIN], ["<F1>"],
"Open the introductory help page", "Open the introductory help page",
function () { dactyl.help(); }); function () { dactyl.help(); });
mappings.add(modes.all, ["<A-F1>"], mappings.add([modes.MAIN], ["<A-F1>"],
"Open the single, consolidated help page", "Open the single, consolidated help page",
function () { ex.helpall(); }); function () { ex.helpall(); });

View File

@@ -661,11 +661,14 @@ var Mappings = Module("mappings", {
let args = { let args = {
getMode: function (args) findMode(args["-mode"]), getMode: function (args) findMode(args["-mode"]),
iterate: function (args) { iterate: function (args, mainOnly) {
let mainMode = this.getMode(args); let modes = [this.getMode(args)];
if (!mainOnly)
modes = modes.concat(modes[0].bases);
let seen = {}; let seen = {};
// Bloody hell. --Kris // Bloody hell. --Kris
for (let mode in values([mainMode].concat(mainMode.bases))) for (let [i, mode] in Iterator(modes))
for (let hive in mappings.hives.iterValues()) for (let hive in mappings.hives.iterValues())
for (let map in array.iterValues(hive.getStack(mode))) for (let map in array.iterValues(hive.getStack(mode)))
for (let name in values(map.names)) for (let name in values(map.names))
@@ -673,7 +676,7 @@ var Mappings = Module("mappings", {
yield { yield {
name: name, name: name,
columns: [ columns: [
mode == mainMode ? "" : <span highlight="Object" style="padding-right: 1em;">{mode.name}</span>, i === 0 ? "" : <span highlight="Object" style="padding-right: 1em;">{mode.name}</span>,
hive == mappings.builtin ? "" : <span highlight="Object" style="padding-right: 1em;">{hive.name}</span> hive == mappings.builtin ? "" : <span highlight="Object" style="padding-right: 1em;">{hive.name}</span>
], ],
__proto__: map __proto__: map
@@ -711,9 +714,11 @@ var Mappings = Module("mappings", {
__proto__: args, __proto__: args,
name: [mode.char + "listk[eys]", mode.char + "lk"], name: [mode.char + "listk[eys]", mode.char + "lk"],
iterateIndex: function (args) iterateIndex: function (args)
let (self = this, prefix = mode.char == "n" ? "" : mode.char + "_") let (self = this, prefix = /^[bCmn]$/.test(mode.char) ? "" : mode.char + "_",
tags = services["dactyl:"].HELP_TAGS)
({ helpTag: prefix + map.name, __proto__: map } ({ helpTag: prefix + map.name, __proto__: map }
for (map in self.iterate(args))), for (map in self.iterate(args, true))
if (map.hive === mappings.builtin || set.has(tags, prefix + map.name))),
description: "List all " + mode.name + " mode mappings along with their short descriptions", description: "List all " + mode.name + " mode mappings along with their short descriptions",
index: mode.char + "-map", index: mode.char + "-map",
getMode: function (args) mode, getMode: function (args) mode,

View File

@@ -36,6 +36,7 @@ var Modes = Module("modes", {
this.boundProperties = {}; this.boundProperties = {};
this.addMode("BASE", { this.addMode("BASE", {
char: "b",
description: "The base mode for all other modes", description: "The base mode for all other modes",
bases: [], bases: [],
count: false count: false
@@ -47,6 +48,7 @@ var Modes = Module("modes", {
count: false count: false
}); });
this.addMode("COMMAND", { this.addMode("COMMAND", {
char: "C",
description: "The base mode for most modes which accept commands rather than input" description: "The base mode for most modes which accept commands rather than input"
}); });

View File

@@ -14,8 +14,16 @@
This file contains a list of all available commands, mappings and options. This file contains a list of all available commands, mappings and options.
<h2 tag="b-map-index">Base mode</h2>
<h2 tag="m-map-index">Main mode</h2>
<h2 tag="I-map-index">Input mode</h2>
<h2 tag="i-map-index">Insert mode</h2> <h2 tag="i-map-index">Insert mode</h2>
<h2 tag="C-map-index">Command mode</h2>
<h2 tag="n-map-index">Normal mode</h2> <h2 tag="n-map-index">Normal mode</h2>
<h2 tag="v-map-index">Visual mode</h2> <h2 tag="v-map-index">Visual mode</h2>