fix: restore word wrap in diff editor left pane after window resize#315230
Open
yeousunn wants to merge 1 commit into
Open
fix: restore word wrap in diff editor left pane after window resize#315230yeousunn wants to merge 1 commit into
yeousunn wants to merge 1 commit into
Conversation
When the diff editor window is narrowed below the `renderSideBySideInlineBreakpoint` (900px by default), it switches to inline mode and sets `wordWrapOverride2 = 'off'` on the original editor to disable wrapping. When the window widens back and returns to side-by-side mode, `wordWrapOverride2` was never reset, since `applyUpdate` only touches properties explicitly present in the update object, the stale `'off'` value silently took precedence over `wordWrapOverride1`, leaving word wrap permanently broken in the left editor until the tab was cycled. Fix by resetting `wordWrapOverride2 = 'inherit'` in the side-by-side branch of `_adjustOptionsForLeftHandSide`, restoring delegation to `wordWrapOverride1`. The right (modified) editor was unaffected because `_adjustOptionsForRightHandSide` never sets `wordWrapOverride2`. Fixes: word wrap not re-applying on left side of diff editor after resize
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a regression in the diff editor where word wrap could remain permanently disabled in the original (left) pane after switching into inline mode due to narrow width and then returning to side-by-side mode.
Changes:
- Restore word-wrap behavior on the original editor by resetting
wordWrapOverride2back to'inherit'when side-by-side rendering is active.
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.
Fixes word wrap breaking in the original (left) editor of the diff view after resizing the window narrower than the inline breakpoint (~900px) and back.
Root Cause
When the diff editor narrows below
renderSideBySideInlineBreakpoint(900px default), it switches to inline mode and setswordWrapOverride2 = 'off'on the original editor to suppress wrapping. When the window widens back to side-by-side mode, onlywordWrapOverride1was restored —wordWrapOverride2remained'off'and silently took precedence, permanently disabling word wrap on the left editor until the tab was cycled.The right (modified) editor was unaffected because
_adjustOptionsForRightHandSidenever setswordWrapOverride2.Fix
Reset
wordWrapOverride2 = 'inherit'in the side-by-side branch of_adjustOptionsForLeftHandSide, restoring delegation towordWrapOverride1.How to Test