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

Fix focus bug. Closes issue #212.

--HG--
branch : bootstrapped
This commit is contained in:
Kris Maglione
2010-12-27 11:10:50 -05:00
parent a7b8cac7de
commit e93f7455f2
5 changed files with 7 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns="http://www.w3.org/1999/xhtml" id="dactyl-buffer">
<head>
<title/>
</head>

View File

@@ -256,6 +256,7 @@ var CommandWidgets = Class("CommandWidgets", {
let elem = this.multilineOutput;
elem.contentWindow.addEventListener("unload", function (event) { event.preventDefault(); }, true);
elem.contentDocument.documentElement.id = "dactyl-multiline-output-top";
elem.contentDocument.body.id = "dactyl-multiline-output-content";
elem.__defineGetter__("atEnd", function ()
!Buffer.isScrollable(elem.contentDocument.documentElement, 1));
@@ -1858,6 +1859,7 @@ var ItemList = Class("ItemList", {
this._win = iframe.contentWindow;
this._container = iframe.parentNode;
this._doc.documentElement.id = id + "-top";
this._doc.body.id = id + "-content";
this._doc.body.className = iframe.className + "-content";
this._doc.body.appendChild(this._doc.createTextNode(""));

View File

@@ -398,13 +398,12 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
},
focus: function focus(elem, flags) {
util.dump("focus(" + (elem instanceof Element ? util.objectToString(elem) : elem) + ")");
flags = flags || services.focus.FLAG_BYMOUSE;
try {
if (elem instanceof Document)
elem = elem.defaultView;
if (elem instanceof Window)
elem.focus();
services.focus.focusedWindow = elem;
else
services.focus.setFocus(elem, flags);
} catch (e) {
@@ -445,13 +444,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
catch (e) {}
if (clearFocusedElement) {
util.dump("blur(" + (dactyl.focusedElement instanceof Element ? util.objectToString(dactyl.focusedElement)
: dactyl.focusedElement) +
")");
if (dactyl.focusedElement)
dactyl.focusedElement.blur();
if (win && Editor.getEditor(win)) {
util.dump("blur(" + win + ")");
win.blur();
if (win.frameElement)
util.dump("blur(" + util.objectToString(win.frameElement) + ")");
@@ -465,8 +460,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
if (elem && elem != dactyl.focusedElement)
dactyl.focus(elem);
if (services.focus.focusedWindow == null)
util.dumpStack("focusedWindow == null");
},
/** @property {Element} The currently focused element. */

View File

@@ -51,8 +51,7 @@ var Modes = Module("modes", {
}
});
this.addMode("COMMAND_LINE", { char: "c", input: true,
display: function () modes.extended & modes.OUTPUT_MULTILINE ? null : this.disp });
this.addMode("COMMAND_LINE", { char: "c", input: true });
this.addMode("CARET", {}, {
get pref() prefs.get("accessibility.browsewithcaret"),
@@ -82,7 +81,7 @@ var Modes = Module("modes", {
postExecute: function (map) { if (modes.main == modes.QUOTE && map.name === "<C-v>") modes.pop() },
onEvent: function () { if (modes.main == modes.QUOTE) modes.pop() }
});
this.addMode("OUTPUT_MULTILINE");
this.addMode("OUTPUT_MULTILINE", { ownsFocus: true });
// this._extended modes, can include multiple modes, and even main modes
this.addMode("EX", true);

View File

@@ -486,7 +486,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
*/
dumpStack: function dumpStack(msg, frames) {
let stack = util.stackLines(Error().stack);
stack = stack.slice(2, 2 + (frames || stack.length)).join("\n");
stack = stack.slice(2, 2 + (frames || stack.length)).join("\n").replace(/^/gm, " ");
util.dump((arguments.length == 0 ? "Stack" : msg) + "\n" + stack + "\n");
},