mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Merge remote-tracking branch 'origin/select-from-file-finder'
Conflicts: src/extensions/fuzzy-finder.coffee static/fuzzy-finder.css
This commit is contained in:
@@ -23,7 +23,7 @@ describe 'FuzzyFinder', ->
|
||||
|
||||
rootView.trigger 'fuzzy-finder:toggle-file-finder'
|
||||
expect(rootView.find('.fuzzy-finder')).toExist()
|
||||
expect(rootView.find('.fuzzy-finder input:focus')).toExist()
|
||||
expect(finder.miniEditor.isFocused).toBeTruthy()
|
||||
finder.miniEditor.insertText('this should not show up next time we toggle')
|
||||
|
||||
rootView.trigger 'fuzzy-finder:toggle-file-finder'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{View, $$} = require 'space-pen'
|
||||
stringScore = require 'stringscore'
|
||||
fuzzyFilter = require 'fuzzy-filter'
|
||||
$ = require 'jquery'
|
||||
Editor = require 'editor'
|
||||
|
||||
module.exports =
|
||||
@@ -28,6 +29,7 @@ class FuzzyFinder extends View
|
||||
@on 'move-up', => @moveUp()
|
||||
@on 'move-down', => @moveDown()
|
||||
@on 'fuzzy-finder:select-path', => @select()
|
||||
@on 'mousedown', 'li', (e) => @entryClicked(e)
|
||||
|
||||
@miniEditor.buffer.on 'change', => @populatePathList() if @hasParent()
|
||||
@miniEditor.off 'move-up move-down'
|
||||
@@ -81,10 +83,16 @@ class FuzzyFinder extends View
|
||||
select: ->
|
||||
selectedLi = @findSelectedLi()
|
||||
return unless selectedLi.length
|
||||
path = selectedLi.text()
|
||||
@rootView.open(selectedLi.text(), {@allowActiveEditorChange})
|
||||
@open(selectedLi.text())
|
||||
|
||||
open : (path) ->
|
||||
return unless path.length
|
||||
@rootView.open(path, {@allowActiveEditorChange})
|
||||
@detach()
|
||||
|
||||
select: ->
|
||||
@open(@findSelectedLi().text())
|
||||
|
||||
moveUp: ->
|
||||
@findSelectedLi()
|
||||
.filter(':not(:first-child)')
|
||||
@@ -101,3 +109,6 @@ class FuzzyFinder extends View
|
||||
|
||||
findMatches: (query) ->
|
||||
fuzzyFilter(@paths, query, maxResults: @maxResults)
|
||||
|
||||
entryClicked: (e) ->
|
||||
@open($(e.currentTarget).text())
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.fuzzy-finder li:hover {
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
.fuzzy-finder ol:empty {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user