Moved -1 inside Math.min

This commit is contained in:
Maciek Jurczyk 2015-06-23 00:43:27 +02:00
parent f1d61164b9
commit 9a4cf6dbfb

View File

@ -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;
};