mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Using getCurrentWordBufferRange instead of getCurrentWord
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -102,8 +102,9 @@ class FuzzyFinder extends SelectList
|
||||
else
|
||||
return unless @rootView.project.getPath()?
|
||||
@allowActiveEditorChange = false
|
||||
cursor = @rootView.getActiveEditor().getCursor()
|
||||
currentWord = cursor.getCurrentWord(wordRegex: @filenameRegex)
|
||||
editor = @rootView.getActiveEditor()
|
||||
range = editor.getCursor().getCurrentWordBufferRange(wordRegex: @filenameRegex)
|
||||
currentWord = editor.getTextInRange(range)
|
||||
if currentWord?
|
||||
@populateProjectPaths(filter: currentWord, done: (paths) =>
|
||||
if paths?.length == 1
|
||||
|
||||
Reference in New Issue
Block a user