summaryrefslogtreecommitdiff
path: root/common/content/commandline.js
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2010-12-24 18:32:22 -0500
committerKris Maglione <maglione.k@gmail.com>2010-12-24 18:32:22 -0500
commitd3d60548f13ea9061f87ec203a7dfb3e8332b8cd (patch)
treead424026e7789a7fe78d8ca66ac21e964539840d /common/content/commandline.js
parent2f081bd80518a4c0dc38948c657ab7360ce0383a (diff)
downloadpentadactyl-d3d60548f13ea9061f87ec203a7dfb3e8332b8cd.tar.gz
Fix some cleanup issues.
--HG-- branch : bootstrapped
Diffstat (limited to 'common/content/commandline.js')
-rw-r--r--common/content/commandline.js29
1 files changed, 22 insertions, 7 deletions
diff --git a/common/content/commandline.js b/common/content/commandline.js
index e4ca3534..3454f0e0 100644
--- a/common/content/commandline.js
+++ b/common/content/commandline.js
@@ -135,9 +135,25 @@ const CommandWidgets = Class("CommandWidgets", {
getGroup: function (value) {
if (this.command && !options.get("guioptions").has("M"))
return this.statusbar;
+
let statusElem = this.statusbar.message;
- if (value && statusElem.inputField.editor.rootElement.scrollWidth > statusElem.scrollWidth)
- return this.commandbar;
+ if (!statusElem.editor) {
+ util.dump(commandline == window.dactyl.modules.commandline,
+ window.dactyl.modules.commandline.widgets == this,
+ commandline.widgets == this);
+ util.dumpStack();
+
+ for (let i=0, e = statusElem; e; e = e.parentNode)
+ util.dump(i++, e == statusline._statusLine.firstChild,
+ e == statusline.widgets.container,
+ e);
+ util.dump(statusElem == statusline.widgets.message);
+ util.dump(statusline._statusLine.firstChild == statusline.widgets.container);
+ }
+ else {
+ if (value && statusElem.editor.rootElement.scrollWidth > statusElem.scrollWidth)
+ return this.commandbar;
+ }
return this.activeGroup.mode;
}
});
@@ -165,13 +181,13 @@ const CommandWidgets = Class("CommandWidgets", {
const self = this;
this.elements[obj.name] = obj;
- function get(id) obj.getElement ? obj.getElement(id) : document.getElementById(id);
+ function get(prefix, map, id) (obj.getElement || util.identity)(map[id] || document.getElementById(prefix + id));
this.active.__defineGetter__(obj.name, function () self.activeGroup[obj.name][obj.name]);
this.activeGroup.__defineGetter__(obj.name, function () self.getGroup(obj.name));
- memoize(this.statusbar, obj.name, function () get("dactyl-statusline-field-" + (obj.id || obj.name)));
- memoize(this.commandbar, obj.name, function () get("dactyl-" + (obj.id || obj.name)));
+ memoize(this.statusbar, obj.name, function () get("dactyl-statusline-field-", statusline.widgets, (obj.id || obj.name)));
+ memoize(this.commandbar, obj.name, function () get("dactyl-", {}, (obj.id || obj.name)));
if (!(obj.noValue || obj.getValue))
Object.defineProperty(this, obj.name, Modes.boundProperty({
@@ -259,8 +275,7 @@ const CommandWidgets = Class("CommandWidgets", {
multilineInput: Class.memoize(function () document.getElementById("dactyl-multiline-input")),
mowContainer: Class.memoize(function () this.multilineOutput.parentNode)
}, {
- getEditor: function (id) {
- let elem = document.getElementById(id);
+ getEditor: function (elem) {
elem.inputField.QueryInterface(Ci.nsIDOMNSEditableElement);
return elem;
}