From ca0c68c9bfe024befa868fc59fee848f2b96eb2d Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Wed, 13 Oct 2010 13:34:37 +0200 Subject: [PATCH] fix: CPTokenFieldToken impacted by new CPTextField sizeToFit behaviour --- AppKit/CPTokenField.j | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/AppKit/CPTokenField.j b/AppKit/CPTokenField.j index 334d8b41f..298c373e5 100755 --- a/AppKit/CPTokenField.j +++ b/AppKit/CPTokenField.j @@ -974,9 +974,15 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting", [super sizeToFit]; var size = [self bounds].size, - minSize = [self currentValueForThemeAttribute:@"min-size"]; + minSize = [self currentValueForThemeAttribute:@"min-size"], + contentInset = [self currentValueForThemeAttribute:@"content-inset"]; size.height = minSize.height; + + // this is necessary to recalculate the width of the token due to new CPTextField sizeToFit + // behaviour that doesn't resize width on bezeled textfield + size.width = [([self stringValue] || @" ") sizeWithFont:[self font]].width + contentInset.left + contentInset.right; + [self setFrameSize:size]; }