Make moveLeft() with huge values span multiple rows

This commit is contained in:
Ben Ogle
2014-09-03 15:27:42 -07:00
parent 99c07decf2
commit 29f15d0f20
2 changed files with 20 additions and 5 deletions

View File

@@ -274,9 +274,14 @@ class Cursor extends Model
if newColumn >= 0
column = newColumn
else if row > 0
row--
column = @editor.lineTextForScreenRow(row).length + newColumn + 1
else
columnDelta = -(newColumn + 1)
while columnDelta >= 0 and row > 0
row--
rowLength = @editor.lineTextForScreenRow(row).length
column = rowLength - columnDelta
columnDelta -= rowLength
column = Math.max(column, 0)
@setScreenPosition({row, column})