mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 06:58:00 +01:00
Fix <Tab>.
This commit is contained in:
@@ -688,13 +688,17 @@ const Events = Module("events", {
|
|||||||
// TODO: Merge with onFocusChange
|
// TODO: Merge with onFocusChange
|
||||||
onFocus: function onFocus(event) {
|
onFocus: function onFocus(event) {
|
||||||
let elem = event.originalTarget;
|
let elem = event.originalTarget;
|
||||||
|
if (elem instanceof Element) {
|
||||||
|
let win = elem.ownerDocument.defaultView;
|
||||||
|
|
||||||
if (Events.isContentNode(elem) && !buffer.focusAllowed(elem)
|
if (Events.isContentNode(elem) && !buffer.focusAllowed(elem)
|
||||||
&& isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
|
&& !(services.focus.getLastFocusMethod(win) & 0x7000)
|
||||||
if (elem.frameElement)
|
&& isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
|
||||||
dactyl.focusContent(true);
|
if (elem.frameElement)
|
||||||
else if (!(elem instanceof Window) || Editor.getEditor(elem))
|
dactyl.focusContent(true);
|
||||||
elem.blur();
|
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 win = window.document.commandDispatcher.focusedWindow;
|
||||||
let elem = window.document.commandDispatcher.focusedElement;
|
let elem = window.document.commandDispatcher.focusedElement;
|
||||||
|
|
||||||
if (elem == null && Editor.getEditor(win))
|
if (elem == null && Editor.getEditor(win))
|
||||||
elem = win;
|
elem = win;
|
||||||
|
|
||||||
@@ -790,7 +795,7 @@ const Events = Module("events", {
|
|||||||
util.threadYield(true);
|
util.threadYield(true);
|
||||||
|
|
||||||
while (modes.main.ownsFocus)
|
while (modes.main.ownsFocus)
|
||||||
modes.pop();
|
modes.pop(null, { fromFocus: true });
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
this._lastFocus = elem;
|
this._lastFocus = elem;
|
||||||
@@ -1136,15 +1141,6 @@ const Events = Module("events", {
|
|||||||
[":"], "Enter command-line mode",
|
[":"], "Enter command-line mode",
|
||||||
function () { commandline.open(":", "", modes.EX); });
|
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,
|
mappings.add(modes.all,
|
||||||
["<C-z>"], "Temporarily ignore all " + config.appName + " key bindings",
|
["<C-z>"], "Temporarily ignore all " + config.appName + " key bindings",
|
||||||
function () { modes.push(modes.PASS_THROUGH); });
|
function () { modes.push(modes.PASS_THROUGH); });
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ const Modes = Module("modes", {
|
|||||||
prefs.set("accessibility.browsewithcaret", false);
|
prefs.set("accessibility.browsewithcaret", false);
|
||||||
|
|
||||||
statusline.updateUrl();
|
statusline.updateUrl();
|
||||||
if (prev.mainMode.input || prev.mainMode.ownsFocus)
|
if (!stack.fromFocus && (prev.mainMode.input || prev.mainMode.ownsFocus))
|
||||||
dactyl.focusContent(true);
|
dactyl.focusContent(true);
|
||||||
if (prev.main == modes.NORMAL) {
|
if (prev.main == modes.NORMAL) {
|
||||||
dactyl.focusContent(true);
|
dactyl.focusContent(true);
|
||||||
@@ -275,11 +275,11 @@ const Modes = Module("modes", {
|
|||||||
this.set(mainMode, extendedMode, params, { push: this.topOfStack });
|
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) {
|
while (this._modeStack.length > 1 && this.main != mode) {
|
||||||
let a = this._modeStack.pop();
|
let a = this._modeStack.pop();
|
||||||
this.set(this.topOfStack.main, this.topOfStack.extended, this.topOfStack.params,
|
this.set(this.topOfStack.main, this.topOfStack.extended, this.topOfStack.params,
|
||||||
{ pop: a });
|
update({ pop: a }, args || {}));
|
||||||
|
|
||||||
if (mode == null)
|
if (mode == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user