diff --git a/src/Terminal.ts b/src/Terminal.ts index 087fb379..c7706008 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -1893,6 +1893,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II const userScrolling = this._userScrolling; this._setup(); + this._bufferService.reset(); // reattach this._customKeyEventHandler = customKeyEventHandler; diff --git a/src/common/TestUtils.test.ts b/src/common/TestUtils.test.ts index 2d699cf8..c982df25 100644 --- a/src/common/TestUtils.test.ts +++ b/src/common/TestUtils.test.ts @@ -20,6 +20,7 @@ export class MockBufferService implements IBufferService { this.cols = cols; this.rows = rows; } + reset(): void {} } export class MockOptionsService implements IOptionsService { diff --git a/src/common/services/BufferService.ts b/src/common/services/BufferService.ts index bbac7803..6ff08061 100644 --- a/src/common/services/BufferService.ts +++ b/src/common/services/BufferService.ts @@ -18,15 +18,19 @@ export class BufferService implements IBufferService { public get buffer(): IBuffer { return this.buffers.active; } constructor( - optionsService: IOptionsService + private _optionsService: IOptionsService ) { - this.cols = Math.max(optionsService.options.cols, MINIMUM_COLS); - this.rows = Math.max(optionsService.options.rows, MINIMUM_ROWS); - this.buffers = new BufferSet(optionsService, this); + this.cols = Math.max(_optionsService.options.cols, MINIMUM_COLS); + this.rows = Math.max(_optionsService.options.rows, MINIMUM_ROWS); + this.buffers = new BufferSet(_optionsService, this); } public resize(cols: number, rows: number): void { this.cols = cols; this.rows = rows; } + + public reset(): void { + this.buffers = new BufferSet(this._optionsService, this); + } } diff --git a/src/common/services/Services.d.ts b/src/common/services/Services.d.ts index 0da78fc7..efc273d2 100644 --- a/src/common/services/Services.d.ts +++ b/src/common/services/Services.d.ts @@ -15,6 +15,7 @@ export interface IBufferService { // TODO: Move resize event here resize(cols: number, rows: number): void; + reset(): void; } export interface IOptionsService {