X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Fcontent%2Fmodes.js;h=c498830903670defc855de8d4e1723fe4acc806b;hb=70740024f9c028c1fd63e1a1850ab062ff956054;hp=55fa19fe6965ccb3e19200e68f7dfda52a9b0087;hpb=eeed0be1a8abf7e3c97f43b63c1d595e940fef21;p=dactyl.git diff --git a/common/content/modes.js b/common/content/modes.js index 55fa19f..c498830 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -62,8 +62,7 @@ var Modes = Module("modes", { description: "Active when text is selected", display: function () "VISUAL" + (this._extended & modes.LINE ? " LINE" : ""), bases: [this.COMMAND], - ownsFocus: true, - passUnknown: false + ownsFocus: true }, { leave: function (stack, newMode) { if (newMode.main == modes.CARET) { @@ -77,7 +76,7 @@ var Modes = Module("modes", { }); this.addMode("CARET", { description: "Active when the caret is visible in the web content", - bases: [this.COMMAND] + bases: [this.NORMAL] }, { get pref() prefs.get("accessibility.browsewithcaret"), @@ -99,13 +98,22 @@ var Modes = Module("modes", { char: "t", description: "Vim-like editing of input elements", bases: [this.COMMAND], - input: true, - ownsFocus: true, - passUnknown: false + ownsFocus: true + }, { + onKeyPress: function (eventList) { + const KILL = false, PASS = true; + + // Hack, really. + if (eventList[0].charCode || /^<(?:.-)*(?:BS|Del|C-h|C-w|C-u|C-k)>$/.test(events.toString(eventList[0]))) { + dactyl.beep(); + return KILL; + } + return PASS; + } }); this.addMode("OUTPUT_MULTILINE", { description: "Active when the multi-line output buffer is open", - bases: [this.COMMAND], + bases: [this.NORMAL] }); this.addMode("INPUT", { @@ -199,6 +207,52 @@ var Modes = Module("modes", { } }); + + function makeTree() { + let list = modes.all.filter(function (m) m.name !== m.description); + + let tree = {}; + + for (let mode in values(list)) + tree[mode.name] = {}; + + for (let mode in values(list)) + for (let base in values(mode.bases)) + tree[base.name][mode.name] = tree[mode.name]; + + let roots = iter([m.name, tree[m.name]] for (m in values(list)) if (!m.bases.length)).toObject(); + + default xml namespace = NS; + function rec(obj) { + XML.ignoreWhitespace = XML.prettyPrinting = false; + + let res =