Cursor can move to last row when lines are wrapped

This commit is contained in:
Nathan Sobo
2012-02-27 13:07:59 -07:00
parent 22305f350f
commit f24a045e11
3 changed files with 14 additions and 5 deletions

View File

@@ -60,11 +60,7 @@ class Cursor extends View
moveDown: ->
{ row, column } = @getScreenPosition()
column = @goalColumn if @goalColumn?
if row < @editor.buffer.numLines() - 1
@setScreenPosition({row: row + 1, column: column})
else
@moveToLineEnd()
@setScreenPosition({row: row + 1, column: column})
@goalColumn = column
moveToLineEnd: ->

View File

@@ -141,6 +141,12 @@ class Editor extends View
linesForScreenRows: (start, end) ->
@lineWrapper.linesForScreenRows(start, end)
screenLineCount: ->
@lineWrapper.lineCount()
lastScreenRow: ->
@screenLineCount() - 1
setBuffer: (@buffer) ->
@highlighter = new Highlighter(@buffer)
@lineFolder = new LineFolder(@highlighter)