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

Last commit, only better and with collateral fixes.

--HG--
branch : groups
This commit is contained in:
Kris Maglione
2011-02-07 17:17:34 -05:00
parent 9cb22db804
commit f3ca43cea9
2 changed files with 55 additions and 25 deletions

View File

@@ -9,7 +9,30 @@
var MOW = Module("mow", {
init: function () {
this._resize = Timer(20, 400, function (force) { this.resize(force) }, this);
this._resize = Timer(20, 400, function () {
if (this.visible) {
this.resize(false);
this.updateMorePrompt();
}
}, this);
this._timer = Timer(20, 400, function () {
util.dump("RESIZE " + this.window.document.body.textContent);
this.resize(true);
if (options["more"] && this.isScrollable(1)) {
// start the last executed command's output at the top of the screen
let elements = this.document.getElementsByClassName("ex-command-output");
elements[elements.length - 1].scrollIntoView(true);
}
else
this.body.scrollTop = this.body.scrollHeight;
dactyl.focus(this.window);
this.updateMorePrompt();
}, this);
events.listen(window, this, "windowEvents");
let fontSize = util.computedStyle(document.documentElement).fontSize;
styles.system.add("font-size", "dactyl://content/buffer.xhtml",
@@ -112,7 +135,7 @@ var MOW = Module("mow", {
// FIXME: need to make sure an open MOW is closed when commands
// that don't generate output are executed
if (this.widgets.mowContainer.collapsed) {
if (!this.visible) {
this.body.scrollTop = 0;
body.textContent = "";
}
@@ -123,18 +146,9 @@ var MOW = Module("mow", {
if (!silent)
dactyl.triggerObserver("echoMultiline", data, highlightGroup, output);
this._resize.tell(true);
if (options["more"] && this.isScrollable(1)) {
// start the last executed command's output at the top of the screen
let elements = this.document.getElementsByClassName("ex-command-output");
elements[elements.length - 1].scrollIntoView(true);
}
else
this.body.scrollTop = this.body.scrollHeight;
dactyl.focus(this.window);
this.updateMorePrompt();
this._timer.tell();
if (!this.visible)
this._timer.flush();
},
events: {
@@ -172,6 +186,12 @@ var MOW = Module("mow", {
}
},
windowEvents: {
resize: function onResize(event) {
this._resize.tell();
}
},
contextEvents: {
popupshowing: function (event) {
let menu = commandline.widgets.contextMenu;
@@ -208,14 +228,14 @@ var MOW = Module("mow", {
* already so.
*/
resize: function updateOutputHeight(open, extra) {
if (!open && this.widgets.mowContainer.collapsed)
if (!(open || this.visible))
return;
let doc = this.widget.contentDocument;
let availableHeight = config.outputHeight;
if (!this.widgets.mowContainer.collapsed)
availableHeight += parseFloat(this.widgets.mowContainer.height);
if (this.visible)
availableHeight += parseFloat(this.widgets.mowContainer.height || 0);
availableHeight -= extra || 0;
doc.body.style.minWidth = this.widgets.commandbar.commandline.scrollWidth + "px";
@@ -225,6 +245,7 @@ var MOW = Module("mow", {
0);
doc.body.style.minWidth = "";
this.visible = true;
},
@@ -243,7 +264,7 @@ var MOW = Module("mow", {
* and what they do.
*/
updateMorePrompt: function updateMorePrompt(force, showHelp) {
if (this.widgets.mowContainer.collapsed)
if (!this.visible)
return this.widgets.message = null;
let elem = this.widget.contentDocument.documentElement;
@@ -256,6 +277,7 @@ var MOW = Module("mow", {
},
visible: Modes.boundProperty({
get: function get_mowVisible() !this.widgets.mowContainer.collapsed,
set: function set_mowVisible(value) {
this.widgets.mowContainer.collapsed = !value;