mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 02:57:59 +01:00
Fix <Tab>.
This commit is contained in:
@@ -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); });
|
||||
|
||||
@@ -90,7 +90,7 @@ const Modes = Module("modes", {
|
||||
prefs.set("accessibility.browsewithcaret", false);
|
||||
|
||||
statusline.updateUrl();
|
||||
if (prev.mainMode.input || prev.mainMode.ownsFocus)
|
||||
if (!stack.fromFocus && (prev.mainMode.input || prev.mainMode.ownsFocus))
|
||||
dactyl.focusContent(true);
|
||||
if (prev.main == modes.NORMAL) {
|
||||
dactyl.focusContent(true);
|
||||
@@ -275,11 +275,11 @@ const Modes = Module("modes", {
|
||||
this.set(mainMode, extendedMode, params, { push: this.topOfStack });
|
||||
},
|
||||
|
||||
pop: function pop(mode) {
|
||||
pop: function pop(mode, args) {
|
||||
while (this._modeStack.length > 1 && this.main != mode) {
|
||||
let a = this._modeStack.pop();
|
||||
this.set(this.topOfStack.main, this.topOfStack.extended, this.topOfStack.params,
|
||||
{ pop: a });
|
||||
update({ pop: a }, args || {}));
|
||||
|
||||
if (mode == null)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user