diff --git a/src/app/edit-session.coffee b/src/app/edit-session.coffee index 7e7791963..8e64e2012 100644 --- a/src/app/edit-session.coffee +++ b/src/app/edit-session.coffee @@ -498,6 +498,9 @@ class EditSession getCurrentParagraphBufferRange: -> @getCursor().getCurrentParagraphBufferRange() + getWordUnderCursor: (options) -> + @getTextInBufferRange(@getCursor().getCurrentWordBufferRange(options)) + moveCursorUp: (lineCount) -> @moveCursors (cursor) -> cursor.moveUp(lineCount) diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 649d8afbd..bcb7e023f 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -209,6 +209,7 @@ class Editor extends View setCursorBufferPosition: (position, options) -> @activeEditSession.setCursorBufferPosition(position, options) getCursorBufferPosition: -> @activeEditSession.getCursorBufferPosition() getCurrentParagraphBufferRange: -> @activeEditSession.getCurrentParagraphBufferRange() + getWordUnderCursor: (options) -> @activeEditSession.getWordUnderCursor(options) getSelection: (index) -> @activeEditSession.getSelection(index) getSelections: -> @activeEditSession.getSelections() diff --git a/src/packages/fuzzy-finder/src/fuzzy-finder.coffee b/src/packages/fuzzy-finder/src/fuzzy-finder.coffee index 64f271be9..01bdade9a 100644 --- a/src/packages/fuzzy-finder/src/fuzzy-finder.coffee +++ b/src/packages/fuzzy-finder/src/fuzzy-finder.coffee @@ -103,17 +103,16 @@ class FuzzyFinder extends SelectList return unless @rootView.project.getPath()? @allowActiveEditorChange = false editor = @rootView.getActiveEditor() - range = editor.getCursor().getCurrentWordBufferRange(wordRegex: @filenameRegex) - currentWord = editor.getTextInRange(range) + currentWord = editor.getWordUnderCursor(wordRegex: @filenameRegex) if currentWord.length == 0 @attach() - @setError('The cursor is not over a filename') + @setError("The cursor is not over a filename") else @populateProjectPaths filter: currentWord, done: (paths) => if paths.length == 0 @attach() - @setError('No files match \'currentWord\'') + @setError("No files match '#{currentWord}'") else if paths.length == 1 @rootView.open(paths[0]) else