1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-05 11:15:46 +01:00

add onMultilineOutputEvent for handling more-prompt keypress events

This commit is contained in:
Doug Kearns
2007-08-04 13:38:28 +00:00
parent b1a0af0ad5
commit f71a3c1722
2 changed files with 17 additions and 3 deletions

View File

@@ -146,6 +146,9 @@ function CommandLine() //{{{
multiline_output_widget.style.height = height + "px";
multiline_output_widget.collapsed = false;
setTimeout(function() {
multiline_output_widget.focus();
}, 10);
multiline_output_widget.contentWindow.scrollTo(0, content_height); // scroll to the end when 'nomore' is set
}
@@ -530,7 +533,7 @@ function CommandLine() //{{{
}
}
this.onMultilineEvent = function(event)
this.onMultilineInputEvent = function(event)
{
// for now we just receive keypress events
@@ -548,6 +551,16 @@ function CommandLine() //{{{
}
}
this.onMultilineOutputEvent = function(event)
{
var key = event.toString();
if (key == "<Return>" || key == "<C-j>" || key == "<C-m>")
{
multiline_output_widget.collapsed = true;
vimperator.focusContent();
}
}
// it would be better if we had a destructor in javascript ...
this.destroy = function()
{

View File

@@ -100,10 +100,11 @@ the terms of any one of the MPL, the GPL or the LGPL.
onblur="vimperator.commandline.onEvent(event);"/>
</hbox>
<iframe id="vimperator-multiline-output" src="about:blank" flex="1" hidden="false" collapsed="true"/>
<iframe id="vimperator-multiline-output" src="about:blank" flex="1" hidden="false" collapsed="true"
onkeypress="vimperator.commandline.onMultilineOutputEvent(event)"/>
<textbox id="vimperator-multiline-input" class="plain" flex="1" rows="10" hidden="false" collapsed="true" multiline="true"
onkeypress="vimperator.commandline.onMultilineEvent(event);"/>
onkeypress="vimperator.commandline.onMultilineInputEvent(event);"/>
</vbox>
</toolbar>