Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(composer): scale the mode chip reservation with the appearance font (#1879)
Liu Zixiang94061cd4503b
diff --git a/apps/desktop/src/styles/theme-overrides.css b/apps/desktop/src/styles/theme-overrides.cssindex a7b2ac964..a6d46416f 100644--- a/apps/desktop/src/styles/theme-overrides.css+++ b/apps/desktop/src/styles/theme-overrides.css@@ -216,12 +216,16 @@}/* Keep the Agent/Plan/Goal trigger stable while its localized label changes.- The width covers the longest built-in label plus the menu caret. */+ The width covers the longest built-in label plus the menu caret, and scales+ with the label's font: the label multiplies --font-scale (--text-sm), so a+ fixed 96px clipped it to "智…" at 115% (#1866). The icon and caret keep+ their fixed pixel sizes, so the scaled width over-provisions slightly —+ the slack lands on the label, which is where clipping actually happened. */.composer-mode-chip {- width: 96px;- min-width: 96px;- max-width: 96px;- flex: 0 0 96px;+ width: calc(96px * var(--font-scale, 1));+ min-width: calc(96px * var(--font-scale, 1));+ max-width: calc(96px * var(--font-scale, 1));+ flex: 0 0 calc(96px * var(--font-scale, 1));justify-content: space-between;}diff --git a/apps/desktop/test/composer-chip-descenders.test.mjs b/apps/desktop/test/composer-chip-descenders.test.mjsindex 4e5ed84da..52ebbc735 100644--- a/apps/desktop/test/composer-chip-descenders.test.mjs+++ b/apps/desktop/test/composer-chip-descenders.test.mjs@@ -65,10 +65,14 @@ test("mode selector reserves the longest localized label width", () => {);const block = styles.match(/\.composer-mode-chip\s*\{[^}]+\}/)?.[0] ?? "";- assert.match(block, /width:\s*96px;/);- assert.match(block, /min-width:\s*96px;/);- assert.match(block, /max-width:\s*96px;/);- assert.match(block, /flex:\s*0 0 96px;/);+ // The reservation scales with the label's font (--font-scale), so the+ // localized mode name stays complete at every appearance font size (#1866).+ for (const prop of ["width", "min-width", "max-width", "flex"]) {+ assert.match(+ block,+ new RegExp(`${prop.replace("-", "\\-")}:\\s*${prop === "flex" ? "0 0 " : ""}calc\\(96px \\* var\\(--font-scale, 1\\)\\);`),+ );+ }assert.match(styles, /\.composer-mode-chip-label\s*\{[\s\S]*?text-overflow:\s*ellipsis;/);});