Merge pull request #1109 from Tyriar/1029_fix_end_selection

Fix last column selection problems
This commit is contained in:
Daniel Imms
2017-11-06 07:43:20 -08:00
committed by GitHub
3 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -495,7 +495,7 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
// If the cursor was above or below the viewport, make sure it's at the
// start or end of the viewport respectively.
if (this._dragScrollAmount > 0) {
this._model.selectionEnd[0] = this._terminal.cols - 1;
this._model.selectionEnd[0] = this._terminal.cols;
} else if (this._dragScrollAmount < 0) {
this._model.selectionEnd[0] = 0;
}
+1 -1
View File
@@ -77,7 +77,7 @@ export class SelectionRenderLayer extends BaseRenderLayer {
// Draw final row
if (viewportCappedStartRow !== viewportCappedEndRow) {
// Only draw viewportEndRow if it's not the same as viewporttartRow
// Only draw viewportEndRow if it's not the same as viewportStartRow
const endCol = viewportEndRow === viewportCappedEndRow ? end[0] : terminal.cols;
this.fillCells(0, viewportCappedEndRow, endCol, 1);
}
+4 -2
View File
@@ -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;