Permalink
Browse files

Fix drawing ref labels on the next tableview column

If there are a large number of refs pointing to a commit, then they may be drawn on top of or behind the other columns.

This will not show any labels that don't fit.
  • Loading branch information...
brotherbard committed Feb 26, 2010
1 parent ca846bc commit 4a9abd2d8c357ebbb2c5aafee9f86456b9c91d8f
Showing with 7 additions and 5 deletions.
  1. +7 −5 PBGitRevisionCell.m
View
@@ -149,8 +149,8 @@ -(NSArray *)rectsForRefsinRect:(NSRect) rect;
static const int ref_spacing = 2;
NSRect lastRect = rect;
- lastRect.origin.x = round(lastRect.origin.x) - 0.5;
- lastRect.origin.y = round(lastRect.origin.y) - 0.5;
+ lastRect.origin.x = round(lastRect.origin.x) + 0.5;
+ lastRect.origin.y = round(lastRect.origin.y) + 0.5;
for (PBGitRef *ref in self.objectValue.refs) {
NSMutableDictionary* attributes = [self attributesForRefLabelSelected:NO];
@@ -161,9 +161,11 @@ -(NSArray *)rectsForRefsinRect:(NSRect) rect;
newRect.size.height = textSize.height;
newRect.origin.y = rect.origin.y + (rect.size.height - newRect.size.height) / 2;
- [array addObject:[NSValue valueWithRect:newRect]];
- lastRect = newRect;
- lastRect.origin.x += (int)lastRect.size.width + ref_spacing;
+ if (NSContainsRect(rect, newRect)) {
+ [array addObject:[NSValue valueWithRect:newRect]];
+ lastRect = newRect;
+ lastRect.origin.x += (int)lastRect.size.width + ref_spacing;
+ }
}
return array;

0 comments on commit 4a9abd2

Please sign in to comment.