Support buffers with scrollback of 0, force alt as 0

Fixes #802
This commit is contained in:
Daniel Imms
2017-08-06 18:18:49 -07:00
parent 27f7679494
commit a57f55dcbf
5 changed files with 68 additions and 51 deletions
+5 -6
View File
@@ -464,7 +464,7 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
this.element.classList.toggle(`xterm-cursor-style-bar`, value === 'bar');
break;
case 'scrollback':
this.buffers.refreshMaxLength(this.rows);
this.buffers.resize(this.cols, this.rows);
this.viewport.syncScrollArea();
break;
case 'tabStopWidth': this.setupStops(); break;
@@ -1177,17 +1177,16 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
let row;
// Make room for the new row in lines
if (this.buffer.lines.length === this.buffer.lines.maxLength) {
const bufferNeedsTrimming = this.buffer.lines.length === this.buffer.lines.maxLength;
if (bufferNeedsTrimming) {
this.buffer.lines.trimStart(1);
this.buffer.ybase--;
if (this.buffer.ydisp !== 0) {
this.buffer.ydisp--;
}
this.buffer.ydisp = Math.max(this.buffer.ydisp - 1, 0);
}
this.buffer.ybase++;
// TODO: Why is this done twice?
// Scroll the viewport down to the bottom if the user is not scrolling
if (!this.userScrolling) {
this.buffer.ydisp = this.buffer.ybase;
}