Terminal.prototype.scroll = function() {
var row;
+ // Make room for the new row in lines
+ if (this.lines.length === this.lines.maxLength) {
+ this.lines.trimStart(1);
+ this.ybase--;
+ if (this.ydisp !== 0) {
+ this.ydisp--;
+ }
+ }
+
this.ybase++;
// TODO: Why is this done twice?
row -= this.rows - 1 - this.scrollBottom;
if (row === this.lines.length) {
- // Compensate ybase and ydisp if lines has hit the maximum buffer size
- if (this.lines.length === this.lines.maxLength) {
- this.ybase--;
- if (this.ydisp !== 0) {
- this.ydisp--;
- }
- }
// Optimization: pushing is faster than splicing when they amount to the same behavior
this.lines.push(this.blankLine());
} else {