mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 00:17:58 +01:00
limit the size of the multiline output window to the size of the browser panel
This commit is contained in:
@@ -141,6 +141,7 @@ function Mappings() //{{{
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME: this doesn't work
|
||||
this.remove = function(map)
|
||||
{
|
||||
var index;
|
||||
|
||||
@@ -138,12 +138,21 @@ function CommandLine() //{{{
|
||||
|
||||
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>";
|
||||
multiline_widget.contentDocument.body.innerHTML = cmd;
|
||||
|
||||
// size according to content -- TODO: if too large, leave a scrollbar)
|
||||
multiline_widget.style.height = multiline_widget.contentDocument.height + "px";
|
||||
// TODO: resize upon a window resize
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user