Permalink
Browse files

Truncate details using NSLineBreakByTruncatingMiddle

Fixes #525
  • Loading branch information...
1 parent 0ed19f0 commit ce9e6e69efe0322995067a1b8cc1a6085d531c27 @pjrobertson committed Oct 16, 2012
@@ -17,7 +17,6 @@
NSDictionary *nameAttributes;
NSDictionary *detailsAttributes;
NSDictionary *rankedNameAttributes;
- NSRect lastFrame;
NSTextView *fieldEditor;
}
@@ -389,7 +389,7 @@ - (void)drawIconForObject:(QSObject *)object withFrame:(NSRect)cellFrame inView:
- (void)buildStylesForFrame:(NSRect)cellFrame inView:(NSView *)controlView {
NSMutableParagraphStyle *style = [[[NSMutableParagraphStyle alloc] init] autorelease];
- [style setLineBreakMode:NSLineBreakByTruncatingTail];
+ [style setLineBreakMode:NSLineBreakByTruncatingMiddle];
[style setFirstLineHeadIndent:1.0];
[style setHeadIndent:1.0];
[style setAlignment:[self alignment]];
@@ -498,12 +498,9 @@ - (void)drawTextForObject:(QSObject *)drawObject withFrame:(NSRect)cellFrame inV
CGFloat detailHeight = NSHeight(textDrawRect) -nameSize.height;
NSRange returnRange;
- if (detailHeight<detailsSize.height && (returnRange = [detailsString rangeOfString:@"\n"]) .location != NSNotFound)
+ if (detailHeight<detailsSize.height && (returnRange = [detailsString rangeOfString:@"\n"]) .location != NSNotFound) {
detailsString = [detailsString substringToIndex:returnRange.location];
- if ([detailsString length] >100) detailsString = [detailsString substringWithRange:NSMakeRange(0, 100)];
- // ***warning ** this should take first line only?
- //if ([titleString length]) [titleString appendAttributedString:;
-
+ }
}
}
Oops, something went wrong.

0 comments on commit ce9e6e6

Please sign in to comment.