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

Fix <Tab>.

This commit is contained in:
Kris Maglione
2010-12-20 12:21:56 -05:00
parent 3335d0844b
commit 05a1c0cce0
2 changed files with 15 additions and 19 deletions

View File

@@ -688,13 +688,17 @@ const Events = Module("events", {
// TODO: Merge with onFocusChange
onFocus: function onFocus(event) {
let elem = event.originalTarget;
if (elem instanceof Element) {
let win = elem.ownerDocument.defaultView;
if (Events.isContentNode(elem) && !buffer.focusAllowed(elem)
&& isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
if (elem.frameElement)
dactyl.focusContent(true);
else if (!(elem instanceof Window) || Editor.getEditor(elem))
elem.blur();
if (Events.isContentNode(elem) && !buffer.focusAllowed(elem)
&& !(services.focus.getLastFocusMethod(win) & 0x7000)
&& isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
if (elem.frameElement)
dactyl.focusContent(true);
else if (!(elem instanceof Window) || Editor.getEditor(elem))
elem.blur();
}
}
},
@@ -734,6 +738,7 @@ const Events = Module("events", {
let win = window.document.commandDispatcher.focusedWindow;
let elem = window.document.commandDispatcher.focusedElement;
if (elem == null && Editor.getEditor(win))
elem = win;
@@ -790,7 +795,7 @@ const Events = Module("events", {
util.threadYield(true);
while (modes.main.ownsFocus)
modes.pop();
modes.pop(null, { fromFocus: true });
}
finally {
this._lastFocus = elem;
@@ -1136,15 +1141,6 @@ const Events = Module("events", {
[":"], "Enter command-line mode",
function () { commandline.open(":", "", modes.EX); });
// focus events
mappings.add([modes.NORMAL, modes.PLAYER, modes.VISUAL, modes.CARET].filter(util.identity),
["<Tab>"], "Advance keyboard focus",
function () { document.commandDispatcher.advanceFocus(); });
mappings.add([modes.NORMAL, modes.PLAYER, modes.VISUAL, modes.CARET, modes.INSERT, modes.TEXT_EDIT].filter(util.identity),
["<S-Tab>"], "Rewind keyboard focus",
function () { document.commandDispatcher.rewindFocus(); });
mappings.add(modes.all,
["<C-z>"], "Temporarily ignore all " + config.appName + " key bindings",
function () { modes.push(modes.PASS_THROUGH); });