diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 5210a928..e1223e7e 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -1130,6 +1130,8 @@ export class InputHandler implements IInputHandler { this._terminal.scrollBottom = this._terminal.normal.scrollBottom; this._terminal.tabs = this._terminal.normal.tabs; this._terminal.normal = null; + // Ensure the selection manager has the correct buffer + this._terminal.selectionManager.setBuffer(this._terminal.lines); // if (params === 1049) { // this.x = this.savedX; // this.y = this.savedY; diff --git a/src/SelectionManager.ts b/src/SelectionManager.ts index 6dc34c65..8b4923a9 100644 --- a/src/SelectionManager.ts +++ b/src/SelectionManager.ts @@ -136,6 +136,15 @@ export class SelectionManager extends EventEmitter { this._rowContainer.addEventListener('mousedown', this._mouseDownListener); } + /** + * Sets the active buffer, this should be called when the alt buffer is + * switched in or out. + * @param buffer The active buffer. + */ + public setBuffer(buffer: CircularList): void { + this._buffer = buffer; + } + /** * Gets the text currently selected. */ diff --git a/src/xterm.js b/src/xterm.js index 2d74a2d5..1ba3facf 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -251,6 +251,10 @@ function Terminal(options) { while (i--) { this.lines.push(this.blankLine()); } + // Ensure the selection manager has the correct buffer + if (this.selectionManager) { + this.selectionManager.setBuffer(this.lines); + } this.tabs; this.setupStops();