From 662b1ec69684c39af8e6fe1908e6a28224f32da2 Mon Sep 17 00:00:00 2001 From: Samir Gartner Date: Fri, 9 Sep 2011 12:48:18 -0500 Subject: [PATCH] Submitted the right CPTokenField file, was missing the part to use the delegate approved tokens. Still lacks a way to put the cursor after the last token (if the delegate returns more than one token) --- AppKit/CPTokenField.j | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/AppKit/CPTokenField.j b/AppKit/CPTokenField.j index ac35a1dd6..481ca298d 100755 --- a/AppKit/CPTokenField.j +++ b/AppKit/CPTokenField.j @@ -208,8 +208,14 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting", [objectValue removeObjectAtIndex:_selectedRange.location]; //confirm with the delegate the token inclusion - if ([[self tokenField:self shouldAddObjects:[CPArray arrayWithObject:token] atIndex:index] count]) - [objectValue insertObject:token atIndex:_selectedRange.location]; + delegateApprovedObjects = [self tokenField:self shouldAddObjects:[CPArray arrayWithObject:token] atIndex:index]; + if (delegateApprovedObjects) + { + for(var i = 0; i < [delegateApprovedObjects count]; i++) + { + [objectValue insertObject:[delegateApprovedObjects objectAtIndex:i] atIndex:_selectedRange.location + i]; + } + } var location = _selectedRange.location; [self setObjectValue:objectValue];