+2
-15
@@ -21,9 +21,9 @@ export class BufferSet extends EventEmitter implements IBufferSet {
|
||||
*/
|
||||
constructor(private _terminal: ITerminal) {
|
||||
super();
|
||||
this._normal = new Buffer(this._terminal);
|
||||
this._normal = new Buffer(this._terminal, false);
|
||||
this._normal.fillViewportRows();
|
||||
this._alt = new Buffer(this._terminal);
|
||||
this._alt = new Buffer(this._terminal, true);
|
||||
this._activeBuffer = this._normal;
|
||||
}
|
||||
|
||||
@@ -71,22 +71,10 @@ export class BufferSet extends EventEmitter implements IBufferSet {
|
||||
// Since the alt buffer is always cleared when the normal buffer is
|
||||
// activated, we want to fill it when switching to it.
|
||||
this._alt.fillViewportRows();
|
||||
|
||||
this._activeBuffer = this._alt;
|
||||
this.emit('activate', this._alt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes the max length of the buffer set, this should be called whenever
|
||||
* terminal rows or scrollback changes.
|
||||
* @param rows The number of terminal rows.
|
||||
*/
|
||||
public refreshMaxLength(rows: number): void {
|
||||
this._normal.lines.maxLength = rows + this._terminal.options.scrollback;
|
||||
// TODO: The alt buffer should never have scrollback, see https://github.com/sourcelair/xterm.js/issues/802
|
||||
this._alt.lines.maxLength = rows + this._terminal.options.scrollback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes both normal and alt buffers, adjusting their data accordingly.
|
||||
* @param newCols The new number of columns.
|
||||
@@ -95,6 +83,5 @@ export class BufferSet extends EventEmitter implements IBufferSet {
|
||||
public resize(newCols: number, newRows: number): void {
|
||||
this._normal.resize(newCols, newRows);
|
||||
this._alt.resize(newCols, newRows);
|
||||
this.refreshMaxLength(newRows);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user