diff --git a/ChangeLog b/ChangeLog index f2ca87c5e..57fd88c13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-02-27 Eric Wasylishen + + * Source/NSMenuItemCell.m (-titleRectForBounds:): Keep title rect + inside cell bounds, to prevent drawing text outside of a + NSPopUpButtonCell which has a label that is too long to fit. + 2012-02-27 Fred Kiefer * Source/NSWindowController.m (-initWithWindow:): Set the owner to diff --git a/Source/NSMenuItemCell.m b/Source/NSMenuItemCell.m index 6d95346d9..f248fa6f6 100644 --- a/Source/NSMenuItemCell.m +++ b/Source/NSMenuItemCell.m @@ -565,7 +565,8 @@ static NSString *commandKeyString = @"#"; { // Calculate the image part of cell frame from NSMenuView cellFrame.origin.x += [_menuView imageAndTitleOffset]; - cellFrame.size.width = [_menuView imageAndTitleWidth]; + cellFrame.size.width = MIN(cellFrame.size.width - [_menuView imageAndTitleOffset], + [_menuView imageAndTitleWidth]); switch (_cell.image_position) { @@ -579,11 +580,13 @@ static NSString *commandKeyString = @"#"; case NSImageLeft: cellFrame.origin.x += _imageWidth + GSCellTextImageXDist; - cellFrame.size.width = _titleWidth; + cellFrame.size.width = MIN(cellFrame.size.width - (_imageWidth + GSCellTextImageXDist), + _titleWidth); break; case NSImageRight: - cellFrame.size.width = _titleWidth; + cellFrame.size.width = MIN(cellFrame.size.width - (_imageWidth + GSCellTextImageXDist), + _titleWidth); break; case NSImageBelow: