1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-20 18:25:48 +01:00

quick fix for #9 ("gi" Goes To Address Bar, not to Webpage)

This commit is contained in:
Doug Kearns
2008-11-05 01:58:13 +00:00
parent 6c6b70a2c5
commit a39226ff23

View File

@@ -1053,8 +1053,11 @@ function Events() //{{{
if (liberator.mode == modes.COMMAND_LINE) if (liberator.mode == modes.COMMAND_LINE)
return; return;
function hasHTMLDocument(win) win && win.document && win.document instanceof HTMLDocument
var win = window.document.commandDispatcher.focusedWindow; var win = window.document.commandDispatcher.focusedWindow;
var elem = window.document.commandDispatcher.focusedElement; var elem = window.document.commandDispatcher.focusedElement;
if (elem && elem.readOnly) if (elem && elem.readOnly)
return; return;
@@ -1069,7 +1072,8 @@ function Events() //{{{
{ {
this.wantsModeReset = false; this.wantsModeReset = false;
liberator.mode = modes.INSERT; liberator.mode = modes.INSERT;
buffer.lastInputField = elem; if (hasHTMLDocument(win))
buffer.lastInputField = elem;
return; return;
} }
@@ -1082,15 +1086,15 @@ function Events() //{{{
modes.set(modes.VISUAL, modes.TEXTAREA); modes.set(modes.VISUAL, modes.TEXTAREA);
else else
modes.main = modes.TEXTAREA; modes.main = modes.TEXTAREA;
buffer.lastInputField = elem; if (hasHTMLDocument(win))
buffer.lastInputField = elem;
return; return;
} }
if (config.name == "Muttator") if (config.name == "Muttator")
{ {
// we switch to -- MESSAGE -- mode for muttator, when the main HTML widget gets focus // we switch to -- MESSAGE -- mode for muttator, when the main HTML widget gets focus
if ((win && win.document && win.document instanceof HTMLDocument) if (hasHTMLDocument(win) || elem instanceof HTMLAnchorElement)
|| elem instanceof HTMLAnchorElement)
{ {
if (config.isComposeWindow) if (config.isComposeWindow)
{ {