Merge pull request #308 from Tyriar/294_scroll

Implement scrollPages, scrollToTop, scrollToBottom and add scroll tests
This commit is contained in:
Daniel Imms
2016-10-10 08:33:09 -07:00
committed by GitHub
2 changed files with 117 additions and 0 deletions
+22
View File
@@ -1307,6 +1307,28 @@ 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 (negative scrolls up).
*/
Terminal.prototype.scrollPages = function(pageCount) {
this.scrollDisp(pageCount * (this.rows - 1));
}
/**
* Scrolls the display of the terminal to the top.
*/
Terminal.prototype.scrollToTop = function() {
this.scrollDisp(-this.ydisp);
}
/**
* Scrolls the display of the terminal to the bottom.
*/
Terminal.prototype.scrollToBottom = function() {
this.scrollDisp(this.ybase - this.ydisp);
}
/**
* Writes text to the terminal.
* @param {string} text The text to write to the terminal.