This commit is contained in:
Daniel Imms 2017-08-06 10:25:25 -07:00
parent d46003843b
commit 0731f28615
2 changed files with 16 additions and 0 deletions

View File

@ -43,6 +43,9 @@ export class Buffer implements IBuffer {
return this._lines; return this._lines;
} }
/**
* Fills the buffer's viewport with blank lines.
*/
public fillViewportRows(): void { public fillViewportRows(): void {
if (this._lines.length === 0) { if (this._lines.length === 0) {
let i = this._terminal.rows; let i = this._terminal.rows;
@ -52,6 +55,9 @@ export class Buffer implements IBuffer {
} }
} }
/**
* Clears the buffer to it's initial state, discarding all previous data.
*/
public clear(): void { public clear(): void {
this.ydisp = 0; this.ydisp = 0;
this.ybase = 0; this.ybase = 0;
@ -64,6 +70,11 @@ export class Buffer implements IBuffer {
this.scrollBottom = this._terminal.rows - 1; 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 { public resize(newCols: number, newRows: number): void {
// Don't resize the buffer if it's empty and hasn't been used yet. // Don't resize the buffer if it's empty and hasn't been used yet.
if (this._lines.length === 0) { if (this._lines.length === 0) {

View File

@ -76,6 +76,11 @@ export class BufferSet extends EventEmitter implements IBufferSet {
this.emit('activate', this._alt); 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 { public resize(newCols: number, newRows: number): void {
this._normal.resize(newCols, newRows); this._normal.resize(newCols, newRows);
this._alt.resize(newCols, newRows); this._alt.resize(newCols, newRows);