This commit is contained in:
Daniel Imms
2017-08-06 21:03:59 +03:00
committed by Paris Kasidiaris
parent 6cdd5a6405
commit 24932b16d7
2 changed files with 16 additions and 0 deletions
+11
View File
@@ -44,6 +44,9 @@ export class Buffer implements IBuffer {
return this._lines;
}
/**
* Fills the buffer's viewport with blank lines.
*/
public fillViewportRows(): void {
if (this._lines.length === 0) {
let i = this._terminal.rows;
@@ -53,6 +56,9 @@ export class Buffer implements IBuffer {
}
}
/**
* Clears the buffer to it's initial state, discarding all previous data.
*/
public clear(): void {
this.ydisp = 0;
this.ybase = 0;
@@ -65,6 +71,11 @@ export class Buffer implements IBuffer {
this.scrollBottom = this._terminal.rows - 1;
}
/**
* Resizes the buffer, adjusting its data accordingly.
* @param newCols The new number of columns.
* @param newRows The new number of rows.
*/
public resize(newCols: number, newRows: number): void {
// Don't resize the buffer if it's empty and hasn't been used yet.
if (this._lines.length === 0) {
+5
View File
@@ -76,6 +76,11 @@ export class BufferSet extends EventEmitter implements IBufferSet {
this.emit('activate', this._alt);
}
/**
* Resizes both normal and alt buffers, adjusting their data accordingly.
* @param newCols The new number of columns.
* @param newRows The new number of rows.
*/
public resize(newCols: number, newRows: number): void {
this._normal.resize(newCols, newRows);
this._alt.resize(newCols, newRows);