mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 18:24:09 +03:00
Fix exception when moving to the end of word when there *is* no word
This commit is contained in:
parent
06e281321b
commit
bf9a7cc9a1
@ -296,6 +296,12 @@ describe "EditSession", ->
|
||||
expect(cursor2.getBufferPosition()).toEqual [1, 13]
|
||||
expect(cursor3.getBufferPosition()).toEqual [3, 4]
|
||||
|
||||
it "does not blow up when there is no next word", ->
|
||||
editSession.setCursorBufferPosition [Infinity, Infinity]
|
||||
endPosition = editSession.getCursorBufferPosition()
|
||||
editSession.moveCursorToEndOfWord()
|
||||
expect(editSession.getCursorBufferPosition()).toEqual endPosition
|
||||
|
||||
describe "selection", ->
|
||||
selection = null
|
||||
|
||||
|
@ -130,7 +130,8 @@ class Cursor
|
||||
@setBufferPosition(@getBeginningOfCurrentWordBufferPosition())
|
||||
|
||||
moveToEndOfWord: ->
|
||||
@setBufferPosition(@getEndOfCurrentWordBufferPosition())
|
||||
if position = @getEndOfCurrentWordBufferPosition()
|
||||
@setBufferPosition(position)
|
||||
|
||||
getBeginningOfCurrentWordBufferPosition: (options = {}) ->
|
||||
allowPrevious = options.allowPrevious ? true
|
||||
|
Loading…
Reference in New Issue
Block a user