Don't spill out of document when moving right and left

This commit is contained in:
Danny Greg & Nathan Sobo
2012-01-19 15:40:26 -08:00
parent a606fe55b3
commit 030e241c75
2 changed files with 31 additions and 10 deletions

View File

@@ -37,7 +37,7 @@ class Editor extends Template
{ row, col } = @getPosition()
if col < @buffer.getLine(row).length
col++
else
else if row < @buffer.numLines() - 1
row++
col = 0
@setPosition({row, col})
@@ -54,7 +54,7 @@ class Editor extends Template
{ row, col } = @getPosition()
if col > 0
col--
else
else if row > 0
row--
col = @buffer.getLine(row).length