When no words are found, autocomplete does not raise an exception

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-05-10 10:39:09 -07:00
parent 6eda0d345b
commit d76cc521bd

View File

@@ -80,8 +80,8 @@ class Autocomplete extends View
buildWordList: () ->
wordHash = {}
for word in @currentBuffer.getText().match(@wordRegex)
wordHash[word] ?= true
matches = @currentBuffer.getText().match(@wordRegex)
wordHash[word] ?= true for word in (matches or [])
@wordList = Object.keys(wordHash)