Skip to content

Commit cf87ae2

Browse files
committed
Enable window flushing after setting scroll position
The window flush was being enabled before the scroll position was set, causing the preview to briefly display at position 0 (the flash). Now: 1. Scale webview 2. Set scroll position 3. Refine with syncScrollers if needed 4. Enable window flushing (makes preview visible) This ensures the preview is never visible at the wrong scroll position. Related to #39
1 parent f506888 commit cf87ae2

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

MacDown/Code/Document/MPDocument.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,7 @@ static void (^MPGetPreviewLoadingCompletionHandler(MPDocument *doc))()
231231
return ^{
232232
WebView *webView = weakObj.preview;
233233
NSWindow *window = webView.window;
234-
@synchronized(window) {
235-
if (window.isFlushWindowDisabled)
236-
[window enableFlushWindow];
237-
}
234+
238235
[weakObj scaleWebview];
239236

240237
// Set initial scroll position to prevent flash to top
@@ -249,6 +246,12 @@ static void (^MPGetPreviewLoadingCompletionHandler(MPDocument *doc))()
249246
[weakObj updateHeaderLocations];
250247
[weakObj syncScrollers];
251248
}
249+
250+
// Enable window flushing AFTER scroll position is set
251+
@synchronized(window) {
252+
if (window.isFlushWindowDisabled)
253+
[window enableFlushWindow];
254+
}
252255
};
253256
}
254257

0 commit comments

Comments
 (0)