Skip to content

Commit

Permalink
Bugfix: don't modify rowHeight if delta or stored value is 0
Browse files Browse the repository at this point in the history
Xcode was complaining when setting to 0

Xcode[66942]: ERROR: Negative values for setRowHeight: not allowed (0.000)
  • Loading branch information
slazyk committed Apr 24, 2014
1 parent 19d5dd4 commit 04f6ca6
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,19 @@ - (void) _fa_hackModifyRowHeight {
NSTableView * tableView = [self valueForKey: @"_completionsTableView"];
FATextCompletionListHeaderView * header = (FATextCompletionListHeaderView *) tableView.headerView;
NSInteger rows = MIN(8, [self.session.filteredCompletionsAlpha count]);
double delta = header && rows ? (header.frame.size.height + 1) / rows : 0;

tableView.rowHeight += delta;
if (header && rows) {
tableView.rowHeight += (header.frame.size.height + 1) / rows;
}
}

// Restore the original row height.
- (void) _fa_hackRestoreRowHeight {
NSTableView * tableView = [self valueForKey: @"_completionsTableView"];
tableView.rowHeight = [objc_getAssociatedObject(self, &kRowHeightKey) doubleValue];
double rowHeight = [objc_getAssociatedObject(self, &kRowHeightKey) doubleValue];
if (rowHeight > 0) {
tableView.rowHeight = rowHeight;
}
}

@end

0 comments on commit 04f6ca6

Please sign in to comment.