From fe0d878b23ffaac5faa857ffc811bf83e4b04765 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 9 Oct 2016 12:51:58 -0700 Subject: [PATCH] Implement scrollPages --- src/xterm.js | 8 ++++++++ test/test.js | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/xterm.js b/src/xterm.js index 83592bb..957c3b6 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -1307,6 +1307,14 @@ Terminal.prototype.scrollDisp = function(disp, suppressScrollEvent) { this.refresh(0, this.rows - 1); }; +/** + * Scroll the display of the terminal by a number of pages. + * @param {number} pageCount The number of pages to scroll. + */ +Terminal.prototype.scrollPages = function(pageCount) { + this.scrollDisp(pageCount * (this.rows - 1)); +} + /** * Writes text to the terminal. * @param {string} text The text to write to the terminal. diff --git a/test/test.js b/test/test.js index b5dc20e..fc44b31 100644 --- a/test/test.js +++ b/test/test.js @@ -88,6 +88,12 @@ describe('xterm.js', function() { }); }); + describe('scrollDisp', function() { + it('should scroll a single line', function() { + assert.equal(xterm.ydisp, -1); + }); + }); + describe('evaluateKeyEscapeSequence', function() { it('should return the correct escape sequence for unmodified keys', function() { // Backspace -- 2.39.2