feat: add persistent word-wrap setting for chat code blocks and tables#3480
feat: add persistent word-wrap setting for chat code blocks and tables#3480imabdulazeez wants to merge 5 commits into
Conversation
- adds `chatCodeBlockWordWrap` client setting (default: true) - uses persisted setting as default wrap state in code blocks - adds toggle in general settings panel with reset support
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review Unable to check for correctness in cf71bb9. An unresolved review comment identifies a medium-severity bug where word-wrap state won't update after component mount. Additionally, this PR changes runtime behavior by modifying defaults and extending where the setting applies. You can customize Macroscope's approvability policy. Learn more. |
- extends wrap setting to cover table cells as well as code blocks - updates setting key, UI labels, and reset logic
|
|
||
| export const ClientSettingsSchema = Schema.Struct({ | ||
| autoOpenPlanSidebar: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))), | ||
| chatWordWrap: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))), |
There was a problem hiding this comment.
actually this should probalby just be wordWrap and be applied as default to diff and code views in general?
There was a problem hiding this comment.
makes sense. let me look into it
There was a problem hiding this comment.
@juliusmarminge this is done, please check :)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6684c33. Configure here.
| const [expanded, setExpanded] = useState(false); | ||
| const [expanded, setExpanded] = useState( | ||
| useClientSettings((settings) => settings.chatWordWrap) | ||
| ); |
There was a problem hiding this comment.
Chat wrap ignores updated settings
Medium Severity
The MarkdownTable and MarkdownCodeBlock components initialize their expanded and wrapped states from the chatWordWrap setting using useState. This causes them to only read the setting once on mount. As a result, changes to the chatWordWrap setting (e.g., after async hydration or user toggling) don't update the component's wrap/expand state, leading to an incorrect display until the component remounts.
Reviewed by Cursor Bugbot for commit 6684c33. Configure here.
cdb1184 to
6684c33
Compare
- single wordWrap setting covers code blocks, tables, diffs, and file previews - obsolete chatWordWrap/diffWordWrap keys are stripped on decode


What Changed
Added a Wrap code blocks and tables client setting that controls whether long content in chat messages wraps by default — covering both code blocks and tables.
chatWordWrapboolean in the client settings schema (ClientSettingsSchema+ClientSettingsPatch), defaulting totrue. (Renamed from the earlierchatCodeBlockWordWrapnow that it governs more than code blocks.)MarkdownCodeBlockseeds its per-blockwrappedstate from this setting instead of always starting unwrapped.MarkdownTablenow seeds itsexpanded(wrap) state from the same setting, so wide tables render with wrapped cells by default instead of truncating. The footer expand/collapse toggle still works for ad-hoc overrides.data-wraptable CSS; tables wrap via the existing[data-expanded="true"]styling.ClientSettingstest fixture to the renamed field.Why
Long, unwrapped lines in chat code blocks and wide table cells force horizontal scrolling, which is awkward to read. Previously each block/table started in its non-wrapped state with users having to toggle every one individually. This adds a single, persisted preference so users can make wrapping the default across both content types, while keeping the per-element toggle for exceptions. Default is
trueso the more readable behavior is on out of the box.Screenshots
Settings → General — new "Wrap code blocks and tables" toggle
Chat code block + table with wrap default applied
Checklist
Note
Cursor Bugbot is generating a summary for commit 6684c33. Configure here.
Note
Add persistent word-wrap setting for chat code blocks, tables, diffs, and file previews
diffWordWrapandchatWordWrapsettings with a single unifiedwordWrapboolean inClientSettingsSchema, defaulting totrue.settings.wordWrapinstead of hardcodedfalse.settings.wordWrap, and the Settings UI label is renamed from 'Diff line wrapping' to 'Word wrap'.wordWrapdefaults totrueon first decode, so all surfaces wrap by default for new and existing users whose stored settings lack the key.Macroscope summarized cf71bb9.