Repository navigation
fix(preview): wrap rendered code blocks and enable text wrap by default - #2056
Merged
l0gicgate merged 2 commits intoNov 5, 2026
Merged
Conversation
The document-code text tag forced WrapMode::None, overriding the view's wrap mode, so fenced code blocks never wrapped even with the wrap toggle on. Drop the forced mode and swap the first-line indent for margins so wrapped lines stay inside the code panel. Reserve space on the first code line for the copy button so it no longer covers the text, and count per-line right margins when sizing unwrapped views. Preview text wrap is now on by default; saved preferences keep their choice. Refs lgse#2055
Use the larger of the view and tag right margins when sizing unwrapped document lines, so quotes keep their previous inset. Switch the saved preferences fixture to an explicit false wrap so tests prove a saved choice survives the new default. Refs lgse#2055
This was referenced Nov 5, 2026
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.
Description
Rendered Markdown code blocks never wrapped, even with the preview's wrap toggle on. The
document-codetext tag forcedWrapMode::None, and a tag's wrap mode overrides the view's. This PR drops the forced mode and replaces the first-line indent with left and right margins, so wrapped lines stay inside the code panel. The unwrapped look is unchanged, including code nested in lists.The code-block copy button no longer covers the end of the first code line. That line reserves room on the right for the button. When wrapping is off, the unwrapped width now counts per-line tag margins, so the button sits past the longest line.
Preview text wrap is now on by default, and a settings file without the key also loads with wrap on. A wrap choice already saved in preferences is kept: existing installs that saved
preview_text_wrap = falsestay unwrapped until the user toggles it. Docs are updated to match.Visual evidence
N/A. Agents cannot upload attachments. With wrap on, paragraphs and fenced code blocks (labelled and unlabelled) wrap to the pane width inside the code panel, and the copy button sits clear of the first line. With wrap off, code scrolls horizontally as before.
How to test
Expected result: Wrapping is on by default. The paragraph and the code block both wrap inside the pane, and the copy button does not hide any code text. Turning wrap off makes the code block scroll horizontally, with the copy button past the end of the longest line. Turning it back on wraps again.
Related issue
Closes #2055