         if next.isEqual(cursor.getBufferPosition())
           cursor.moveToEndOfWord()
         else
-          if next.row is @getLastRow() + 1
+          if next.row is @getLastBufferRow() + 1
             cursor.moveToEndOfWord()
           else
             cursor.setBufferPosition(next)

  @extend()
  getRow: ->
    row = @getLastVisibleScreenRow()
    offset = if row is @getLastRow() then 0 else @scrolloff
    row - Math.max(@getCount(), offset)

# keymap: M

  getEofBufferPosition: ->
    getEofBufferPosition(@editor)

  getLastBufferRow: ->
    @getEofBufferPosition().row

  getFirstVisibleScreenRow: ->
