Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(chat): scale message prose width with the content band

vastsa82fa1fe306d7
diff --git a/apps/desktop/src/components/ConversationWidthHandles.tsx b/apps/desktop/src/components/ConversationWidthHandles.tsx
index 107a62644..aa23355c7 100644
--- a/apps/desktop/src/components/ConversationWidthHandles.tsx
+++ b/apps/desktop/src/components/ConversationWidthHandles.tsx
@@ -39,6 +39,11 @@ function applyPreferredWidth(surface: HTMLElement | null, width: number) {
const px = `${width}px`;
surface.style.setProperty("--chat-content-max-width", px);
surface.style.setProperty("--chat-composer-max-width", px);
+ // The per-message prose width must track the band, otherwise the message
+ // rows stay frozen at the `.main-pane` default (760px) while the band it
+ // sits in widens (the bug this fixes: content no longer scales with it).
+ surface.style.setProperty("--chat-prose-max-width", px);
+
}
function setResizing(surface: HTMLElement | null, on: boolean) {
diff --git a/apps/desktop/test/chat-content-width.test.mjs b/apps/desktop/test/chat-content-width.test.mjs
index 40bca9b87..409fd58d4 100644
--- a/apps/desktop/test/chat-content-width.test.mjs
+++ b/apps/desktop/test/chat-content-width.test.mjs
@@ -51,3 +51,27 @@ test("a squeezed pane keeps min\(100%, preferred\) and does not force 640px", ()
/\.thread-content\s*\{[\s\S]*?width:\s*min\(100%,\s*var\(--chat-content-max-width\)\)/,
);
});
+test("dragging the width also scales the per-message prose width", () => {
+ // The drag handler publishes the preferred width to every width consumer so
+ // the message rows track the band (see applyPreferredWidth). Previously the
+ // band widened while --chat-prose-max-width stayed frozen at the .main-pane
+ // default of 760px.
+ assert.match(
+ handleSource,
+ /setProperty\("--chat-content-max-width",\s*px\)/,
+ );
+ assert.match(
+ handleSource,
+ /setProperty\("--chat-composer-max-width",\s*px\)/,
+ );
+ assert.match(
+ handleSource,
+ /setProperty\("--chat-prose-max-width",\s*px\)/,
+ );
+ // The prose fallback must stay aligned with the banner default so a
+ // non-dragged surface still renders both at the same width.
+ assert.match(
+ styles,
+ /--chat-prose-max-width:\s*var\(--chat-content-max-width\)/,
+ );
+});