hterm: support scrolling with shift+up/down arrow keys
This allows you to scroll up/down by one line by using the shift and
arrow keys. This matches the behavior of other terminals like konsole.
Change-Id: Ifc375a7a2de4b53e43d59ad78ebea0a08aa60ec6
Reviewed-on: https://chromium-review.googlesource.com/503688
Reviewed-by: Brandon Gilmore <varz@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/hterm/js/hterm_terminal.js b/hterm/js/hterm_terminal.js
index 66d1f25..e0187e2 100644
--- a/hterm/js/hterm_terminal.js
+++ b/hterm/js/hterm_terminal.js
@@ -1085,6 +1085,22 @@
};
/**
+ * Scroll the terminal one line up relative to the current position.
+ */
+hterm.Terminal.prototype.scrollLineUp = function() {
+ var i = this.scrollPort_.getTopRowIndex();
+ this.scrollPort_.scrollRowToTop(i - 1);
+};
+
+/**
+ * Scroll the terminal one line down relative to the current position.
+ */
+hterm.Terminal.prototype.scrollLineDown = function() {
+ var i = this.scrollPort_.getTopRowIndex();
+ this.scrollPort_.scrollRowToTop(i + 1);
+};
+
+/**
* Clear primary screen, secondary screen, and the scrollback buffer.
*/
hterm.Terminal.prototype.wipeContents = function() {