Merge pull request #1235 from Tyriar/1151_clamp_saved_cursor

Resize saved cursor position on buffer resize
This commit is contained in:
Daniel Imms
2018-01-25 06:55:02 -08:00
committed by GitHub
+4 -7
View File
@@ -177,16 +177,13 @@ export class Buffer implements IBuffer {
}
// Make sure that the cursor stays on screen
if (this.y >= newRows) {
this.y = newRows - 1;
}
this.x = Math.min(this.x, newCols - 1);
this.y = Math.min(this.y, newRows - 1);
if (addToY) {
this.y += addToY;
}
if (this.x >= newCols) {
this.x = newCols - 1;
}
this.savedY = Math.min(this.savedY, newRows - 1);
this.savedX = Math.min(this.savedX, newCols - 1);
this.scrollTop = 0;
}