diff --git a/lib/ui/Editor.js b/lib/ui/Editor.js index 9545aae..d6717d7 100644 --- a/lib/ui/Editor.js +++ b/lib/ui/Editor.js @@ -632,8 +632,8 @@ Editor.prototype._clipCursorToContent = function (cursor) { var linesCount = self.textBuf.getLastRow(); var lineLength = self.textBuf.lineLengthForRow(cursor.y); - cursor.y = Math.max(Math.min(cursor.y, linesCount) - 1, 0); - cursor.x = Math.max(Math.min(cursor.x, lineLength) - 1, 0); + cursor.y = Math.max(Math.min(cursor.y - 1, linesCount), 0); + cursor.x = Math.max(Math.min(cursor.x - 1, lineLength), 0); return cursor; };