mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
moveCursorToBeginningOfWord works when preceded by a blank line
This commit is contained in:
@@ -269,6 +269,11 @@ describe "EditSession", ->
|
||||
editSession.setCursorBufferPosition([0, 0])
|
||||
editSession.moveCursorToBeginningOfWord()
|
||||
|
||||
it "works when the preceding line is blank", ->
|
||||
editSession.setCursorBufferPosition([10, 0])
|
||||
editSession.moveCursorToBeginningOfWord()
|
||||
expect(editSession.getCursorBufferPosition()).toEqual [9, 0]
|
||||
|
||||
describe ".moveCursorToEndOfWord()", ->
|
||||
it "moves the cursor to the end of the word", ->
|
||||
editSession.setCursorBufferPosition [0, 6]
|
||||
|
||||
@@ -120,8 +120,8 @@ class Cursor
|
||||
getBeginningOfCurrentWordBufferPosition: (options = {}) ->
|
||||
allowPrevious = options.allowPrevious ? true
|
||||
currentBufferPosition = @getBufferPosition()
|
||||
previousRow = Math.max(0, currentBufferPosition.row - 1)
|
||||
previousLinesRange = [[previousRow, 0], currentBufferPosition]
|
||||
previousNonBlankRow = @editSession.buffer.previousNonBlankRow(currentBufferPosition.row)
|
||||
previousLinesRange = [[previousNonBlankRow, 0], currentBufferPosition]
|
||||
|
||||
beginningOfWordPosition = currentBufferPosition
|
||||
@editSession.backwardsScanInRange @wordRegex, previousLinesRange, (match, matchRange, { stop }) =>
|
||||
|
||||
Reference in New Issue
Block a user