Repository navigation
Add session content width setting - #8222
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds terminal session content width and alignment settings, including normalization, JSON persistence, settings UI and search integration, localization, schema updates, tests, and SwiftUI layout application for terminal and agent-session panels. ChangesSession Content Width
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant SettingsUI
participant UserDefaults
participant TerminalPanelView
participant SessionContentWidthModifier
SettingsUI->>UserDefaults: store width and alignment
UserDefaults-->>SessionContentWidthModifier: provide persisted values
TerminalPanelView->>SessionContentWidthModifier: apply sessionContentWidth()
SessionContentWidthModifier-->>TerminalPanelView: constrain and align content
Suggested reviewers: 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Greptile SummaryThis PR adds an optional session content-width cap (off by default) for Terminal and Agent Session panels, with left/center/right alignment. The feature is threaded through both SwiftUI (
Confidence Score: 5/5Safe to merge. The SwiftUI and AppKit layout paths are both covered and correctly updated from the same AppStorage source; no correctness gaps were found. The feature is self-contained and opt-in (off by default). The dual-path design is clean and the two paths stay in sync because both subscribe to the same UserDefaults keys. Portal ownership transitions are handled correctly: the canvas path updates via WorkspaceCanvasHostView → CanvasPaneContentMount, while the non-canvas path updates via TerminalPanelView → GhosttyTerminalView.updateNSView when hostOwnsPortalNow is true. The JSON file-store parsing validates range before clamping, maps false to the sentinel, and logs invalid values without crashing. The xcstrings translation gap (en+ja only, 17 locales uncovered) was flagged in a prior thread and is a known open item. Resources/Localizable.xcstrings — 12 new UI string keys only have en and ja translations; the remaining 17 app locales will fall back to raw English strings in the new Settings rows. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
UserDefaults["UserDefaults\n(sessionContentMaxWidth\nsessionContentAlignment)"]
subgraph SwiftUI["SwiftUI Path"]
WCH["WorkspaceCanvasHostView\n@AppStorage reads"]
TPV["TerminalPanelView\n@AppStorage reads"]
ASP["AgentSessionPanelView"]
SCM["SessionContentWidthModifier\n.frame(maxWidth:)\n.frame(maxWidth:infinity, alignment:)"]
end
subgraph AppKit["AppKit Path"]
SCWP["SessionContentWidthPresentation\ncontentFrame(in:bounds)"]
GSSV["GhosttySurfaceScrollView\nlayout()"]
ScrollView["scrollView frame"]
Overlays["Overlays\n(search, reconnect,\nlink hover)"]
BgView["TerminalPaneBackgroundView\nfull-pane size"]
end
subgraph Canvas["Canvas Mount"]
CPM["CanvasPaneContentMount\nupdate(sessionContentWidthPresentation:)"]
end
UserDefaults --> WCH
UserDefaults --> TPV
UserDefaults --> SCM
WCH -->|sessionContentWidthPresentation| CPM
CPM -->|setSessionContentWidthPresentation| SCWP
TPV -->|sessionContentWidthPresentation| GSSV
TPV --> SCM
ASP --> SCM
GSSV --> SCWP
SCWP -->|contentFrame| ScrollView
SCWP -->|contentFrame| Overlays
BgView -->|full bounds, pointer/scroll forwarding| GSSV
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
UserDefaults["UserDefaults\n(sessionContentMaxWidth\nsessionContentAlignment)"]
subgraph SwiftUI["SwiftUI Path"]
WCH["WorkspaceCanvasHostView\n@AppStorage reads"]
TPV["TerminalPanelView\n@AppStorage reads"]
ASP["AgentSessionPanelView"]
SCM["SessionContentWidthModifier\n.frame(maxWidth:)\n.frame(maxWidth:infinity, alignment:)"]
end
subgraph AppKit["AppKit Path"]
SCWP["SessionContentWidthPresentation\ncontentFrame(in:bounds)"]
GSSV["GhosttySurfaceScrollView\nlayout()"]
ScrollView["scrollView frame"]
Overlays["Overlays\n(search, reconnect,\nlink hover)"]
BgView["TerminalPaneBackgroundView\nfull-pane size"]
end
subgraph Canvas["Canvas Mount"]
CPM["CanvasPaneContentMount\nupdate(sessionContentWidthPresentation:)"]
end
UserDefaults --> WCH
UserDefaults --> TPV
UserDefaults --> SCM
WCH -->|sessionContentWidthPresentation| CPM
CPM -->|setSessionContentWidthPresentation| SCWP
TPV -->|sessionContentWidthPresentation| GSSV
TPV --> SCM
ASP --> SCM
GSSV --> SCWP
SCWP -->|contentFrame| ScrollView
SCWP -->|contentFrame| Overlays
BgView -->|full bounds, pointer/scroll forwarding| GSSV
Reviews (6): Last reviewed commit: "Keep capped terminal gutters interactive" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 11
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/messages/ar.json`:
- Around line 934-935: Replace the English placeholder descriptions for
sessionContentMaxWidth and sessionContentAlignment with approved Arabic
translations in web/messages/ar.json lines 934-935 and approved Bosnian
translations in web/messages/bs.json lines 934-935, preserving the existing keys
and JSON structure.
In `@web/messages/da.json`:
- Around line 934-935: Replace the English placeholder descriptions for
sessionContentMaxWidth and sessionContentAlignment with reviewed Danish
translations in web/messages/da.json lines 934-935 and reviewed German
translations in web/messages/de.json lines 934-935; preserve the configuration
meaning in each locale.
In `@web/messages/es.json`:
- Around line 934-935: Replace the English placeholder descriptions for
sessionContentMaxWidth and sessionContentAlignment in web/messages/es.json
(lines 934-935) with accurate Spanish translations, and make the same two
replacements in web/messages/fr.json (lines 934-935) using accurate French
translations. Preserve the existing keys and meaning.
In `@web/messages/it.json`:
- Around line 934-935: Translate the sessionContentMaxWidth and
sessionContentAlignment descriptions in the Italian locale into complete,
natural Italian, preserving their configuration meaning and references to
terminal, built-in agent chat, points, full pane width, and horizontal
placement. Do not leave English fallback text.
In `@web/messages/ko.json`:
- Around line 934-935: Replace the English placeholder descriptions for
sessionContentMaxWidth and sessionContentAlignment with accurate Korean
translations in web/messages/ko.json lines 934-935 and Traditional Chinese
translations in web/messages/zh-TW.json lines 934-935, preserving the existing
meaning and JSON structure.
In `@web/messages/no.json`:
- Around line 934-935: Translate the sessionContentMaxWidth and
sessionContentAlignment schema descriptions in every supported locale listed in
web/i18n/routing.ts, including web/messages/no.json lines 934-935 and
web/messages/pl.json lines 935-936. Preserve the descriptions’ meaning and
formatting while replacing the English text with each locale’s translation.
In `@web/messages/pt-BR.json`:
- Around line 934-935: Translate the values of sessionContentMaxWidth and
sessionContentAlignment in the pt-BR catalog into Brazilian Portuguese,
preserving the documented optional point-based width, false-for-full-pane
behavior, and horizontal alignment semantics. Do not retain English fallback
text.
In `@web/messages/ru.json`:
- Around line 934-935: Replace the English descriptions for
sessionContentMaxWidth and sessionContentAlignment with Russian translations in
web/messages/ru.json lines 934-935, and with Thai translations in
web/messages/th.json lines 935-936; preserve the keys and JSON structure.
In `@web/messages/tr.json`:
- Around line 934-935: Translate the new sessionContentMaxWidth and
sessionContentAlignment schema descriptions in the Turkish catalog into natural
Turkish, replacing the English text while preserving the keys and configuration
semantics.
In `@web/messages/uk.json`:
- Around line 934-935: Translate the user-facing descriptions for
sessionContentMaxWidth and sessionContentAlignment in uk.json into Ukrainian,
preserving the meaning of the optional point-based width, the false value using
full pane width, and alignment applying only when max width is enabled. Do not
retain English fallback text.
In `@web/messages/zh-CN.json`:
- Around line 934-935: Translate the descriptions for sessionContentMaxWidth and
sessionContentAlignment in the zh-CN locale into clear Chinese text. Preserve
the existing meanings, including the false/full-pane-width behavior and the
enabled-width alignment context, and do not leave English fallback strings.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6419b7b4-b6e1-4090-895d-228509e3cd26
📒 Files selected for processing (18)
web/messages/ar.jsonweb/messages/bs.jsonweb/messages/da.jsonweb/messages/de.jsonweb/messages/es.jsonweb/messages/fr.jsonweb/messages/it.jsonweb/messages/km.jsonweb/messages/ko.jsonweb/messages/no.jsonweb/messages/pl.jsonweb/messages/pt-BR.jsonweb/messages/ru.jsonweb/messages/th.jsonweb/messages/tr.jsonweb/messages/uk.jsonweb/messages/zh-CN.jsonweb/messages/zh-TW.json
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/messages/de.json`:
- Line 934: Update the German translation for sessionContentMaxWidth to describe
using the containing pane’s full width when false, replacing “gesamte
Fensterbreite” with “gesamte Breite des Bereichs” or equivalent. Preserve the
rest of the message and its configuration meaning.
In `@web/messages/th.json`:
- Line 935: Update the Thai translation value for sessionContentMaxWidth to
describe using the full pane width rather than the full window width. Replace
the window term in the false-setting explanation with the established pane term
พาเนล, preserving the rest of the translation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6db81b19-0b08-417e-9113-94a2aaff4435
📒 Files selected for processing (18)
web/messages/ar.jsonweb/messages/bs.jsonweb/messages/da.jsonweb/messages/de.jsonweb/messages/es.jsonweb/messages/fr.jsonweb/messages/it.jsonweb/messages/km.jsonweb/messages/ko.jsonweb/messages/no.jsonweb/messages/pl.jsonweb/messages/pt-BR.jsonweb/messages/ru.jsonweb/messages/th.jsonweb/messages/tr.jsonweb/messages/uk.jsonweb/messages/zh-CN.jsonweb/messages/zh-TW.json
Summary
Verification
swift testinPackages/macOS/CmuxSettingsswift testinPackages/macOS/CmuxSettingsUI./scripts/check-pbxproj.sh./scripts/lint-pbxproj-test-wiring.shswcap/tmp/cmux-debug-swcap.sock: 640-point centered terminal reported 90 columns and wrapped a long line; Agent Session surface loaded with the same shared layoutThe focused app test was added, but the local Xcode runner stalled during tool discovery before compilation. PR checks will run it.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by cubic
Adds an optional max content width for Terminal and Agent Session with left/center/right alignment, off by default. Keeps capped content inside full-size panes across SwiftUI and AppKit, and preserves gutter click/scroll so focus and scrolling work when clicking beside the content.
New Features
terminal.sessionContentMaxWidth(number 320–2400 pt, step 20; orfalseto disable, default off, remembers last enabled width) andterminal.sessionContentAlignment(left|center|right, defaultcenter)..sessionContentWidth()modifier; AppKit terminals use a sharedSessionContentWidthPresentationso overlays stay full-pane and terminal gutters remain interactive (pointer-down focuses, scroll passes through).Migration
cmux.json:terminal.sessionContentMaxWidthto a number (e.g., 980) orfalseto disable.terminal.sessionContentAlignmenttoleft,center, orright.Written for commit dafd3c3. Summary will update on new commits.
Summary by CodeRabbit