From ae2881404116d8ee655da7ffa2074f22cfe68fed Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Fri, 16 Feb 2018 21:34:57 -0800 Subject: [PATCH] Check for valid coords before getting word at coords Fixes #1287 --- src/SelectionManager.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/SelectionManager.ts b/src/SelectionManager.ts index dc1d0682..5aa145e6 100644 --- a/src/SelectionManager.ts +++ b/src/SelectionManager.ts @@ -634,6 +634,11 @@ export class SelectionManager extends EventEmitter implements ISelectionManager * @param coords The coordinates to get the word at. */ private _getWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean): IWordPosition { + // Ensure coords are within viewport (eg. not within scroll bar) + if (coords[0] >= this._terminal.cols) { + return null; + } + const bufferLine = this._buffer.lines.get(coords[1]); if (!bufferLine) { return null;