mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
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:
@@ -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]
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -478,9 +478,6 @@ class EditSession
|
||||
moveCursorToEndOfLine: ->
|
||||
@moveCursors (cursor) -> cursor.moveToEndOfLine()
|
||||
|
||||
moveCursorToNextWord: ->
|
||||
@moveCursors (cursor) -> cursor.moveToNextWord()
|
||||
|
||||
moveCursorToBeginningOfWord: ->
|
||||
@moveCursors (cursor) -> cursor.moveToBeginningOfWord()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user