Correctly fix the vertical scroller redraw issue.

This commit is contained in:
Lukhnos Liu 2013-01-29 22:16:42 -08:00
parent 1033c74de6
commit 07f663eb00
1 changed files with 7 additions and 12 deletions

View File

@ -41,7 +41,6 @@ static const CGFloat kCandidateTextLeftMargin = 8.0;
- (BOOL)scrollPageByOne:(BOOL)forward;
- (BOOL)moveSelectionByOne:(BOOL)forward;
- (void)layoutCandidateView;
- (void)forceUpdateVerticalScroller;
@end
@implementation VTVerticalCandidateController
@ -254,6 +253,13 @@ static const CGFloat kCandidateTextLeftMargin = 8.0;
NSInteger firstVisibleRow = [_tableView rowAtPoint:[_scrollView documentVisibleRect].origin];
_keyLabelStripView.highlightedIndex = selectedRow - firstVisibleRow;
[_keyLabelStripView setNeedsDisplay:YES];
// fix a subtle OS X "bug" that, since we force the scroller to appear,
// scrolling sometimes shows a temporarily "broken" scroll bar
// (but quickly disappears)
if ([_scrollView hasVerticalScroller]) {
[[_scrollView verticalScroller] setNeedsDisplay];
}
}
}
@ -392,15 +398,4 @@ static const CGFloat kCandidateTextLeftMargin = 8.0;
[_scrollView setFrame:NSMakeRect(stripWidth + 1.0, 0.0, tableViewStartWidth, windowHeight)];
[[self window] setFrame:frameRect display:YES];
}
- (void)forceUpdateVerticalScroller
{
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(deferredForceUpdateVerticalScroller) object:nil];
[self performSelector:@selector(deferredForceUpdateVerticalScroller) withObject:nil afterDelay:0.0];
}
- (void)deferredForceUpdateVerticalScroller
{
[[_scrollView verticalScroller] setNeedsDisplay];
}
@end