Properly reset buffer after Terminal.reset

This commit is contained in:
Daniel Imms
2019-06-08 21:39:10 -07:00
parent f49daf02a3
commit 1b07a03b2f
4 changed files with 11 additions and 4 deletions
+1
View File
@@ -1893,6 +1893,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
const userScrolling = this._userScrolling; const userScrolling = this._userScrolling;
this._setup(); this._setup();
this._bufferService.reset();
// reattach // reattach
this._customKeyEventHandler = customKeyEventHandler; this._customKeyEventHandler = customKeyEventHandler;
+1
View File
@@ -20,6 +20,7 @@ export class MockBufferService implements IBufferService {
this.cols = cols; this.cols = cols;
this.rows = rows; this.rows = rows;
} }
reset(): void {}
} }
export class MockOptionsService implements IOptionsService { export class MockOptionsService implements IOptionsService {
+8 -4
View File
@@ -18,15 +18,19 @@ export class BufferService implements IBufferService {
public get buffer(): IBuffer { return this.buffers.active; } public get buffer(): IBuffer { return this.buffers.active; }
constructor( constructor(
optionsService: IOptionsService private _optionsService: IOptionsService
) { ) {
this.cols = Math.max(optionsService.options.cols, MINIMUM_COLS); this.cols = Math.max(_optionsService.options.cols, MINIMUM_COLS);
this.rows = Math.max(optionsService.options.rows, MINIMUM_ROWS); this.rows = Math.max(_optionsService.options.rows, MINIMUM_ROWS);
this.buffers = new BufferSet(optionsService, this); this.buffers = new BufferSet(_optionsService, this);
} }
public resize(cols: number, rows: number): void { public resize(cols: number, rows: number): void {
this.cols = cols; this.cols = cols;
this.rows = rows; this.rows = rows;
} }
public reset(): void {
this.buffers = new BufferSet(this._optionsService, this);
}
} }
+1
View File
@@ -15,6 +15,7 @@ export interface IBufferService {
// TODO: Move resize event here // TODO: Move resize event here
resize(cols: number, rows: number): void; resize(cols: number, rows: number): void;
reset(): void;
} }
export interface IOptionsService { export interface IOptionsService {