Add bidirectional scroll sync (preview to editor)#261
Merged
Conversation
Implements preview→editor scroll synchronization to complement the existing editor→preview sync. When the user scrolls the preview pane, the editor now scrolls to the corresponding position using the same reference point matching algorithm. Changes: - Add shouldHandlePreviewBoundsChange property for loop prevention - Register NSViewBoundsDidChangeNotification for preview scroll view - Add previewBoundsDidChange: handler to trigger reverse sync - Implement syncScrollersReverse method mirroring syncScrollers algorithm - Update syncScrollers to set preview flag before scrolling - Add 8 unit tests for reverse sync functionality The implementation uses the same header/image reference point matching with tapering at document edges for smooth scrolling behavior. Related to #258
Contributor
Code Coverage ReportCurrent Coverage: 51.70% Coverage Details (Summary) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements preview→editor scroll synchronization to complement the existing editor→preview sync (Issue #39). When the user scrolls the preview pane, the editor now automatically scrolls to the corresponding position.
Changes:
syncScrollersReversemethod mirroring the existingsyncScrollersalgorithmpreviewBoundsDidChange:handler to trigger reverse sync on preview scrollshouldHandlePreviewBoundsChangeflag for loop preventionNSViewBoundsDidChangeNotificationfor preview scroll viewImplementation details:
NSViewBoundsDidChangeNotificationeditorSyncScrollingpreference (no new toggle)Related Issue
Related to #258
Manual Testing Plan
Prerequisites
editorSyncScrollingpreference is enabled (default)Key Test Scenarios
editorSyncScrolling→ verify sync stops in both directionsReview Notes