diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-03-10 13:06:00 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-03-10 13:06:00 +0000 |
commit | 13b87870c8cf9d5445a1da6d20d142d43ac9c2e8 (patch) | |
tree | 7a2bb456d28219dd23a4eb2302d20e0851353a2e /AppKit/GTMUILocalizerAndLayoutTweaker.m | |
parent | a04d6910cfb3faef62b09bd2c2e621b1ce2a6efd (diff) |
[Author: thomasvl]
Don't trim the whitespace off the string when doing test sizing...
TextField does some odd stuff with whitespace when it does wrap things, if you don't include the white space, then when you use the real string (to wrap), it moves the last word down a line because of lack of space for the whitespace (go figure).
Oh, and fix the leak.
R=dmaclach
DELTA=6 (0 added, 1 deleted, 5 changed)
Diffstat (limited to 'AppKit/GTMUILocalizerAndLayoutTweaker.m')
-rw-r--r-- | AppKit/GTMUILocalizerAndLayoutTweaker.m | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/AppKit/GTMUILocalizerAndLayoutTweaker.m b/AppKit/GTMUILocalizerAndLayoutTweaker.m index 771df9d..698fb91 100644 --- a/AppKit/GTMUILocalizerAndLayoutTweaker.m +++ b/AppKit/GTMUILocalizerAndLayoutTweaker.m @@ -290,8 +290,7 @@ static BOOL IsRightAnchored(NSView *view); _GTMDevAssert(tokenizer, @"failed to get a tokenizer"); return 0.0; } - NSCell *workerCell = [cell copy]; - NSCharacterSet *whiteSpaceSet = [NSCharacterSet whitespaceCharacterSet]; + NSCell *workerCell = [[cell copy] autorelease]; // Loop trying line break points until the height fits. while (1) { @@ -308,7 +307,7 @@ static BOOL IsRightAnchored(NSView *view); NSRange subStringRange = NSMakeRange(0, tokenRange.location + tokenRange.length); NSString *subString = [str substringWithRange:subStringRange]; - subString = [subString stringByTrimmingCharactersInSet:whiteSpaceSet]; + //subString = [subString stringByTrimmingCharactersInSet:whiteSpaceSet]; // Find how wide the cell would be for this sub string. [workerCell setStringValue:subString]; |