From cf2116ff6a56d09a6e9f26d3b2b40add131ebb0f Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 27 Dec 2017 08:08:28 -0800 Subject: [PATCH] Prevent dragging from setting selection y over bounds Fixes #1152 --- src/SelectionManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SelectionManager.ts b/src/SelectionManager.ts index 387ce8d1..37f0ab14 100644 --- a/src/SelectionManager.ts +++ b/src/SelectionManager.ts @@ -528,7 +528,7 @@ export class SelectionManager extends EventEmitter implements ISelectionManager this._terminal.scrollLines(this._dragScrollAmount, false); // Re-evaluate selection if (this._dragScrollAmount > 0) { - this._model.selectionEnd = [this._terminal.cols - 1, this._terminal.buffer.ydisp + this._terminal.rows]; + this._model.selectionEnd = [this._terminal.cols - 1, Math.min(this._terminal.buffer.ydisp + this._terminal.rows, this._terminal.buffer.lines.length - 1)]; } else { this._model.selectionEnd = [0, this._terminal.buffer.ydisp]; }