Eliminate 'move-cursor-to-next-word' command

We have move-to-end-of-word and move-to-beginning-of-word, which is what we use for the current keybindings.
This commit is contained in:
Corey Johnson & Nathan Sobo
2012-10-30 11:52:59 -06:00
parent 89ac3f1c82
commit 8c7152a59b
4 changed files with 0 additions and 35 deletions

View File

@@ -252,21 +252,6 @@ describe "EditSession", ->
editSession.setCursorBufferPosition([10, 0])
editSession.moveCursorToFirstCharacterOfLine()
describe ".moveCursorToNextWord()", ->
it "moves the cursor to the next word or the end of file if there is no next word", ->
editSession.setCursorBufferPosition [2, 5]
editSession.addCursorAtBufferPosition [3, 60]
[cursor1, cursor2] = editSession.getCursors()
editSession.moveCursorToNextWord()
expect(cursor1.getBufferPosition()).toEqual [2, 7]
expect(cursor2.getBufferPosition()).toEqual [4, 4]
buffer.insert([12, 2], ' ')
cursor1.setBufferPosition([12, 1])
editSession.moveCursorToNextWord()
expect(cursor1.getBufferPosition()).toEqual [12, 5]
describe ".moveCursorToBeginningOfWord()", ->
it "moves the cursor to the beginning of the word", ->
editSession.setCursorBufferPosition [0, 8]

View File

@@ -117,9 +117,6 @@ class Cursor
moveToEndOfWord: ->
@setBufferPosition(@getEndOfCurrentWordBufferPosition())
moveToNextWord: ->
@setBufferPosition(@getBeginningOfNextWordBufferPosition())
getBeginningOfCurrentWordBufferPosition: (options = {}) ->
allowPrevious = options.allowPrevious ? true
currentBufferPosition = @getBufferPosition()
@@ -146,18 +143,6 @@ class Cursor
stop()
endOfWordPosition
getBeginningOfNextWordBufferPosition: ->
currentBufferPosition = @getBufferPosition()
eofBufferPosition = @editSession.getEofBufferPosition()
range = [currentBufferPosition, eofBufferPosition]
nextWordPosition = eofBufferPosition
@editSession.scanInRange @wordRegex, range, (match, matchRange, { stop }) =>
if matchRange.start.isGreaterThan(currentBufferPosition)
nextWordPosition = matchRange.start
stop()
nextWordPosition
getCurrentWordBufferRange: ->
new Range(@getBeginningOfCurrentWordBufferPosition(allowPrevious: false), @getEndOfCurrentWordBufferPosition(allowNext: false))

View File

@@ -478,9 +478,6 @@ class EditSession
moveCursorToEndOfLine: ->
@moveCursors (cursor) -> cursor.moveToEndOfLine()
moveCursorToNextWord: ->
@moveCursors (cursor) -> cursor.moveToNextWord()
moveCursorToBeginningOfWord: ->
@moveCursors (cursor) -> cursor.moveToBeginningOfWord()

View File

@@ -103,7 +103,6 @@ class Editor extends View
'core:cut': @cutSelection
'core:copy': @copySelection
'core:paste': @paste
'editor:move-to-next-word': @moveCursorToNextWord
'editor:move-to-previous-word': @moveCursorToPreviousWord
'editor:select-word': @selectWord
'editor:newline': @insertNewline
@@ -170,7 +169,6 @@ class Editor extends View
moveCursorDown: -> @activeEditSession.moveCursorDown()
moveCursorLeft: -> @activeEditSession.moveCursorLeft()
moveCursorRight: -> @activeEditSession.moveCursorRight()
moveCursorToNextWord: -> @activeEditSession.moveCursorToNextWord()
moveCursorToBeginningOfWord: -> @activeEditSession.moveCursorToBeginningOfWord()
moveCursorToEndOfWord: -> @activeEditSession.moveCursorToEndOfWord()
moveCursorToTop: -> @activeEditSession.moveCursorToTop()