Skip to content

Commit ec0c14e

Browse files
committed
Fix scrollbar rendering artifact in pre-Mojave renderer
Fix scrollbars not rendering properly when using delayed calls to placeScrollBars. That has issues since pre-Mojave renderer blocks the window from changing size by using `[NSAnimationContext beginGrouping]`. That causes the bug as placeScrollbars would be using state from previous sizes. We could fix this by waiting for the animation to end before called finishPlaceScrollbars but it's more complicated and leads to more state tracking. Instead, just call placeScrollbars when we resize immediately (just like before) instead of deferring. We still defer placing scrollbars for things like creating/deleting scrollbars as we could be doing that a lot of times per frame (e.g. calling `:only` with a lot of splits). Fix #848
1 parent caed4ee commit ec0c14e

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/MacVim/MMVimView.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,19 @@ - (void)frameSizeMayHaveChanged:(BOOL)keepGUISize
929929
NSRect textViewRect = [self textViewRectForVimViewSize:[self frame].size];
930930
[textView setFrame:textViewRect];
931931

932-
self.pendingPlaceScrollbars = YES;
932+
// Immediately place the scrollbars instead of deferring till later here.
933+
// Deferral ended up causing some bugs, in particular when in <10.14
934+
// CoreText renderer where [NSAnimationContext beginGrouping] is used to
935+
// bundle state changes together and the deferred placeScrollbars would get
936+
// the wrong data to use. An alternative would be to check for that and only
937+
// call finishPlaceScrollbars once we call [NSAnimationContext endGrouping]
938+
// but that makes the code mode complicated. Just do it here and the
939+
// performance is fine as this gets called occasionally only
940+
// (pendingPlaceScrollbars is mostly for the case if we are adding a lot of
941+
// scrollbars at once we want to only call placeScrollbars once instead of
942+
// doing it N times).
943+
self.pendingPlaceScrollbars = NO;
944+
[self placeScrollbars];
933945

934946
// It is possible that the current number of (rows,columns) is too big or
935947
// too small to fit the new frame. If so, notify Vim that the text

0 commit comments

Comments
 (0)