diff --git a/src/SelectionManager.ts b/src/SelectionManager.ts index eaf813c9..93957fa8 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;