Skip to content

fix: restore word wrap in diff editor left pane after window resize#315230

Open
yeousunn wants to merge 1 commit into
microsoft:mainfrom
yeousunn:fix/diff-editor-word-wrap-after-resize
Open

fix: restore word wrap in diff editor left pane after window resize#315230
yeousunn wants to merge 1 commit into
microsoft:mainfrom
yeousunn:fix/diff-editor-word-wrap-after-resize

Conversation

@yeousunn
Copy link
Copy Markdown

@yeousunn yeousunn commented May 8, 2026

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 sets wordWrapOverride2 = 'off' on the original editor to suppress wrapping. When the window widens back to side-by-side mode, only wordWrapOverride1 was restored — wordWrapOverride2 remained '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 _adjustOptionsForRightHandSide never sets wordWrapOverride2.

Fix

Reset wordWrapOverride2 = 'inherit' in the side-by-side branch of _adjustOptionsForLeftHandSide, restoring delegation to wordWrapOverride1.

How to Test

  1. Open two files in the diff editor
  2. Enable word wrap
  3. Ensure files contain long lines
  4. Drag the window narrower than ~900px - diff switches to inline view
  5. Drag back to full width - diff returns to side-by-side
  6. Before fix: word wrap missing on left side (text overflows horizontally) 7. After fix: word wrap correctly restored on both sides

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
Copilot AI review requested due to automatic review settings May 8, 2026 10:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 wordWrapOverride2 back to 'inherit' when side-by-side rendering is active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants