diff --git a/src/atom/vim-mode/motions.coffee b/src/atom/vim-mode/motions.coffee index 86d24abc5..d11aff2af 100644 --- a/src/atom/vim-mode/motions.coffee +++ b/src/atom/vim-mode/motions.coffee @@ -6,41 +6,41 @@ class Motion class MoveLeft extends Motion execute: -> - {column, row} = @editor.getPosition() - @editor.moveLeft() if column > 0 + {column, row} = @editor.getCursorPosition() + @editor.moveCursorLeft() if column > 0 select: -> - position = @editor.getPosition() + position = @editor.getCursorPosition() position.column-- if position.column > 0 @editor.selectToPosition position class MoveRight extends Motion execute: -> - {column, row} = @editor.getPosition() - currentLineLength = @editor.getLineText(row).length - @editor.moveRight() if column < currentLineLength + {column, row} = @editor.getCursorPosition() + currentLineLength = @editor.buffer.getLine(row).length + @editor.moveCursorRight() if column < currentLineLength class MoveUp extends Motion execute: -> - {column, row} = @editor.getPosition() - @editor.moveUp() if row > 0 + {column, row} = @editor.getCursorPosition() + @editor.moveCursorUp() if row > 0 class MoveDown extends Motion execute: -> - {column, row} = @editor.getPosition() - @editor.moveDown() if row < (@editor.getAceSession().getLength() - 1) + {column, row} = @editor.getCursorPosition() + @editor.moveCursorDown() if row < (@editor.buffer.numLines() - 1) class MoveToNextWord extends Motion execute: -> - @editor.setPosition(@nextWordPosition()) + @editor.setCursorPosition(@nextWordPosition()) select: -> @editor.selectToPosition(@nextWordPosition()) nextWordPosition: -> regex = getWordRegex() - { row, column } = @editor.getPosition() - rightOfCursor = @editor.getLineText(row).substring(column) + { row, column } = @editor.getCursorPosition() + rightOfCursor = @editor.buffer.getLine(row).substring(column) match = regex.exec(rightOfCursor) # If we're on top of part of a word, match the next one. @@ -62,8 +62,7 @@ class SelectLines extends Motion setCount: (@count) -> select: -> - @editor.setPosition(column: 0, row: @editor.getRow()) - @editor.selectToPosition(column: 0, row: @editor.getRow() + @count) + @editor.setCursorPosition(column: 0, row: @editor.getCursorRow()) + @editor.selectToPosition(column: 0, row: @editor.getCursorRow() + @count) module.exports = { MoveLeft, MoveRight, MoveUp, MoveDown, MoveToNextWord, SelectLines } -