Using getCurrentWordBufferRange instead of getCurrentWord

This commit is contained in:
Corey Johnson
2013-01-21 15:00:17 -08:00
parent f2dcf40a2c
commit 0a5e0a85f8
2 changed files with 7 additions and 11 deletions

View File

@@ -169,8 +169,10 @@ class Cursor
stop()
endOfWordPosition or currentBufferPosition
getCurrentWordBufferRange: ->
new Range(@getBeginningOfCurrentWordBufferPosition(allowPrevious: false), @getEndOfCurrentWordBufferPosition(allowNext: false))
getCurrentWordBufferRange: (options={}) ->
startOptions = _.extend(_.clone(options), allowPrevious: false)
endOptions = _.extend(_.clone(options), allowNext: false)
new Range(@getBeginningOfCurrentWordBufferPosition(startOptions), @getEndOfCurrentWordBufferPosition(endOptions))
getCurrentLineBufferRange: (options) ->
@editSession.bufferRangeForBufferRow(@getBufferRow(), options)
@@ -195,13 +197,6 @@ class Cursor
getCurrentWordPrefix: ->
@editSession.getTextInBufferRange([@getBeginningOfCurrentWordBufferPosition(), @getBufferPosition()])
getCurrentWord: (options = {}) ->
match = @editSession.getTextInBufferRange([@getBeginningOfCurrentWordBufferPosition(options),
@getEndOfCurrentWordBufferPosition(options)])
if match?.length > 2
match.substring(1, match.length-1)
isAtBeginningOfLine: ->
@getBufferPosition().column == 0