diff --git a/src/SelectionManager.ts b/src/SelectionManager.ts index 112ec4a7..28e08cc1 100644 --- a/src/SelectionManager.ts +++ b/src/SelectionManager.ts @@ -459,7 +459,7 @@ export class SelectionManager extends EventEmitter { // Record the resulting selection this._model.selectionStart = [startIndex + charOffset - leftWideCharCount, coords[1]]; - this._model.selectionStartLength = endIndex - startIndex + leftWideCharCount + rightWideCharCount + 1/*include endIndex char*/; + this._model.selectionStartLength = Math.min(endIndex - startIndex + leftWideCharCount + rightWideCharCount + 1/*include endIndex char*/, this._terminal.cols); } private _selectLineAt(line: number): void {