# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1326567956 0 # Node ID 46a2123ff57060dc61eabf1492bac4a14f0e2c99 # Parent f00f91d15cbf204ca718dfaa67dec4921188de61 Cleanup of the previous commits on Mac, don't do more calculations than we need to. diff -r f00f91d15cbf -r 46a2123ff570 mac/dw.m --- a/mac/dw.m Sat Jan 14 17:30:37 2012 +0000 +++ b/mac/dw.m Sat Jan 14 19:05:56 2012 +0000 @@ -3543,7 +3543,6 @@ NSScrollView *sv = [object scrollview]; NSSize frame = [sv frame].size; BOOL hscroll = [sv hasHorizontalScroller]; - BOOL scrolled = FALSE; /* Make sure word wrap is off for the first part */ if(!hscroll) @@ -3563,26 +3562,25 @@ { [[object textContainer] setWidthTracksTextView:YES]; [sv setHasHorizontalScroller:NO]; - } - /* If the un wrapped it is beyond the bounds... */ - if(size.width > _DW_SCROLLED_MAX_WIDTH) - { - NSSize max = [object maxSize]; - /* Set the flag for later */ - scrolled = TRUE; - /* Set the max size to the limit */ - [object setMaxSize:NSMakeSize(_DW_SCROLLED_MAX_WIDTH, max.height)]; - /* Recalculate the size */ - [object sizeToFit]; - size = [object bounds].size; - size.width += 2.0; - size.height += 2.0; - [object setMaxSize:max]; + /* If the un wrapped it is beyond the bounds... */ + if(size.width > _DW_SCROLLED_MAX_WIDTH) + { + NSSize max = [object maxSize]; + + /* Set the max size to the limit */ + [object setMaxSize:NSMakeSize(_DW_SCROLLED_MAX_WIDTH, max.height)]; + /* Recalculate the size */ + [object sizeToFit]; + size = [object bounds].size; + size.width += 2.0; + size.height += 2.0; + [object setMaxSize:max]; + } } [sv setFrameSize:frame]; /* Take into account the horizontal scrollbar */ - if(hscroll && scrolled) + if(hscroll && size.width > _DW_SCROLLED_MAX_WIDTH) size.height += 16.0; } else