splitwise/TokenAutoComplete — pull request #76 by nolanlawson (2014-09-03 16:28:19+00:00)
Title: Fix for prefixes and empty text

This fixes a pair of related bugs.

The first bug is that you cannot input a token that is a substring of another token. Instead, the longer token will always be chosen (whether you press the comma key or the enter key).

The second bug is that, if you override the `getThreshold()` to set it to 1 (instead of the default of 2), then you can just keep pressing the comma key, and it will insert a random token.

![animated](https://cloud.githubusercontent.com/assets/283842/4137476/49b1698c-3387-11e4-9007-f5af5c75ef42.gif)

So in this animated gif, you can first see that I can just keep pressing the comma key and it will just keep adding `"foo"`.

Also, if I enter `"fo"`, I am unable to make a new tag out of that. Instead, `"foo"` is always chosen.

This PR fixes both problems.