From dbec3a32f89498d932220f5d44b48fa40094d8ac Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 5 Nov 2017 12:06:25 -0800 Subject: [PATCH] Fix selecting of last column Fixes #1029 --- src/utils/MouseHelper.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/MouseHelper.ts b/src/utils/MouseHelper.ts index b7ef09ad..d7d8f698 100644 --- a/src/utils/MouseHelper.ts +++ b/src/utils/MouseHelper.ts @@ -62,8 +62,10 @@ export class MouseHelper { coords[0] = Math.ceil((coords[0] + (isSelection ? this._renderer.dimensions.actualCellWidth / 2 : 0)) / this._renderer.dimensions.actualCellWidth); coords[1] = Math.ceil(coords[1] / this._renderer.dimensions.actualCellHeight); - // Ensure coordinates are within the terminal viewport. - coords[0] = Math.min(Math.max(coords[0], 1), colCount); + // Ensure coordinates are within the terminal viewport. Note that selections + // need an addition point of precision to cover the end point (as characters + // cover half of one char and half of the next). + coords[0] = Math.min(Math.max(coords[0], 1), colCount + (isSelection ? 1 : 0)); coords[1] = Math.min(Math.max(coords[1], 1), rowCount); return coords;