Clear array when window receives focus

This commit is contained in:
Corey Johnson & Kevin Sawicki
2012-12-12 15:46:21 -08:00
parent 0c68295ec6
commit e15306d8cc
2 changed files with 4 additions and 1 deletions

View File

@@ -59,6 +59,7 @@ class SelectList extends View
@loading.text(message).show()
populateList: ->
return unless @hasParent()
filterQuery = @miniEditor.getText()
if filterQuery.length
filteredArray = fuzzyFilter(@array, filterQuery, key: @filterKey)

View File

@@ -1,6 +1,7 @@
{View, $$} = require 'space-pen'
SelectList = require 'select-list'
_ = require 'underscore'
$ = require 'jquery'
Editor = require 'editor'
module.exports =
@@ -20,6 +21,7 @@ class FuzzyFinder extends SelectList
initialize: (@rootView) ->
super
$(window).on 'focus', => @array = null
itemForElement: (path) ->
$$ -> @li path
@@ -39,8 +41,8 @@ class FuzzyFinder extends SelectList
else
return unless @rootView.project.getPath()?
@allowActiveEditorChange = false
@populateProjectPaths()
@attach()
@populateProjectPaths()
toggleBufferFinder: ->
if @hasParent()