From: <de...@us...> - 2009-09-19 16:45:10
|
Revision: 1817 http://iterm.svn.sourceforge.net/iterm/?rev=1817&view=rev Author: delx Date: 2009-09-19 16:44:56 +0000 (Sat, 19 Sep 2009) Log Message: ----------- Fixed drawing corruption when new text is placed into a full buffer that is not scrolled to the bottom Modified Paths: -------------- trunk/PTYTextView.m Modified: trunk/PTYTextView.m =================================================================== --- trunk/PTYTextView.m 2009-09-19 14:40:18 UTC (rev 1816) +++ trunk/PTYTextView.m 2009-09-19 16:44:56 UTC (rev 1817) @@ -607,8 +607,8 @@ lastBlink = now; } - // Grow to allow space for drawing the new lines if(height != frame.size.height) { + // Grow to allow space for drawing the new lines // XXX - EPIC HACK below // NSClipView has setCopiesOnScroll:YES by default. According to Apple // this means it will do a quick copy of all the unchanged portion of @@ -643,10 +643,11 @@ [self setNeedsDisplayInRect:dirty]; } } - // Handle scrollback overflows else if(scrollbackOverflow > 0) { NSScrollView* scrollView = [self enclosingScrollView]; + NSClipView* clipView = [scrollView contentView]; float amount = [scrollView verticalLineScroll] * scrollbackOverflow; + BOOL userScroll = [(PTYScroller*)([scrollView verticalScroller]) userScroll]; // Keep correct selection highlighted startY -= scrollbackOverflow; @@ -656,22 +657,27 @@ if(oldStartY < 0) oldStartX = -1; oldEndY -= scrollbackOverflow; - // Keep the users' current scroll position - if([(PTYScroller*)([scrollView verticalScroller]) userScroll]) { + // Keep the users' current scroll position, nothing to redraw + if(userScroll) { NSRect scrollRect = [self visibleRect]; scrollRect.origin.y -= amount; if(scrollRect.origin.y < 0) scrollRect.origin.y = 0; + [clipView setCopiesOnScroll:NO]; [self scrollRectToVisible:scrollRect]; + [clipView setCopiesOnScroll:YES]; + return; } // Shift the old content upwards - if(scrollbackOverflow < [dataSource height]) { + if(scrollbackOverflow < [dataSource height] && !userScroll) { [self scrollRect:[self visibleRect] by:NSMakeSize(0, -amount)]; } + + [self updateDirtyRects]; } - - // Mark dirty chars for redraw - [self updateDirtyRects]; + else { + [self updateDirtyRects]; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |