Fixed with CPTokenField: quickly entered tokens would be ignored.

If the autocomplete state had not been set yet, tokens could not be finished using the token separator, return or tab. Instead the user typed text remained in its 'non token' state.
This commit is contained in:
Alexander Ljungberg committed 2011-11-16 12:52:27 +00:00
1 parent 07966bb7fe
commit 15af54efda
1 file changed
+3 -3
+3 -3
View File
@@ -172,19 +172,19 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
- (void)_autocompleteWithDOMEvent:(JSObject)DOMEvent
{
if (!_cachedCompletions || ![self hasThemeState:CPThemeStateAutoCompleting])
if (![self _inputElement].value && (!_cachedCompletions || ![self hasThemeState:CPThemeStateAutoCompleting]))
return;
[self _hideCompletions];
var token = _cachedCompletions[[_autocompleteView selectedRow]],
var token = _cachedCompletions ? _cachedCompletions[[_autocompleteView selectedRow]] : nil,
shouldRemoveLastObject = token !== @"" && [self _inputElement].value !== @"";
if (!token)
token = [self _inputElement].value;
// Make sure the user typed an actual token to prevent the previous token from being emptied
// If the input area is empty, we want to fallback to the normal behavior, resigning first
// If the input area is empty, we want to fall back to the normal behavior, resigning first
// responder or selecting the next or previous key view.
if (!token || token === @"")
{