1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 02:37:58 +01:00

limit the size of the multiline output window to the size of the browser panel

This commit is contained in:
Doug Kearns
2007-07-10 10:07:08 +00:00
parent f1dcd35334
commit f9ecd3b788
2 changed files with 30 additions and 20 deletions

View File

@@ -141,6 +141,7 @@ function Mappings() //{{{
return true; return true;
} }
// FIXME: this doesn't work
this.remove = function(map) this.remove = function(map)
{ {
var index; var index;

View File

@@ -138,12 +138,21 @@ function CommandLine() //{{{
function setMultiline(cmd) function setMultiline(cmd)
{ {
multiline_widget.collapsed = false; // TODO: we should retain any previous command output like Vim
if (!multiline_widget.collapsed)
multiline_widget.collapsed = true;
cmd = cmd.replace(/\n|\\n/g, "<br/>") + "<br/><span style=\"color: green;\">Press ENTER or type command to continue</span>"; cmd = cmd.replace(/\n|\\n/g, "<br/>") + "<br/><span style=\"color: green;\">Press ENTER or type command to continue</span>";
multiline_widget.contentDocument.body.innerHTML = cmd; multiline_widget.contentDocument.body.innerHTML = cmd;
// size according to content -- TODO: if too large, leave a scrollbar) // TODO: resize upon a window resize
multiline_widget.style.height = multiline_widget.contentDocument.height + "px"; var available_height = getBrowser().mPanelContainer.boxObject.height;
var content_height = multiline_widget.contentDocument.height;
var height = content_height < available_height ? content_height : available_height;
multiline_widget.style.height = height + "px";
multiline_widget.collapsed = false;
multiline_widget.contentWindow.scrollTo(0, content_height); // scroll to the end when 'nomore' is set
} }
function addToHistory(str) function addToHistory(str)