Fix trimming on a buffer with 0 scrollback

Unfortunately this removed the padding idea from CircularList as it
would only work when the list is not full.
This commit is contained in:
Daniel Imms
2017-08-06 18:56:37 -07:00
parent a57f55dcbf
commit e7ee3ec63c
4 changed files with 24 additions and 56 deletions
+6 -6
View File
@@ -154,12 +154,12 @@ export class Buffer implements IBuffer {
// would otherwise cut data from the bottom of the buffer.
if (newMaxLength < this._lines.maxLength) {
// Trim from the top of the buffer and adjust ybase and ydisp.
// const amountToTrim = this._lines.length - newMaxLength;
// if (amountToTrim > 0) {
// this._lines.trimStart(amountToTrim);
// this.ybase = Math.max(this.ybase - amountToTrim, 0);
// this.ydisp = Math.max(this.ydisp - amountToTrim, 0);
// }
const amountToTrim = this._lines.length - newMaxLength;
if (amountToTrim > 0) {
this._lines.trimStart(amountToTrim);
this.ybase = Math.max(this.ybase - amountToTrim, 0);
this.ydisp = Math.max(this.ydisp - amountToTrim, 0);
}
this._lines.maxLength = newMaxLength;
}