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:
@@ -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;
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user