Skip to content

fix(composer): scale the mode chip reservation with the appearance font - #1879

Merged
vastsa merged 1 commit into
vastsa:mainfrom
SeanLiu326:fix/mode-chip-font-scale
Oct 25, 2026
Merged

vastsa merged 1 commit into
vastsa:mainfrom
SeanLiu326:fix/mode-chip-font-scale

Conversation

@SeanLiu326

Copy link
Copy Markdown
Contributor

What this fixes

Fixes #1866 — at 115% appearance font (「超大杯」) the composer's mode trigger clips 「智能体」 to 「智…」; only one character plus the caret remains, so the user cannot tell which mode is active.

Root cause

theme-overrides.css reserved a fixed 96px for .composer-mode-chip (width/min-width/max-width/flex-basis), while the label inside multiplies the appearance token: .composer-mode-chip-label uses text-sm → calc(12px * var(--font-scale)). Per the reporter's arithmetic, at 100% the three-character zh label fits with ~2px to spare; at 115% it needs 41.4px against 38px of available width and the text-overflow: ellipsis on the label does the rest.

Change

Scale the reservation with the same token the label uses:

.composer-mode-chip {
  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));
}

This keeps the original intent of the rule — a stable trigger width across Agent/Plan/Goal switches and localized labels — while making it track the label's font. The mode icon (14px) and caret (12px) keep their fixed pixel sizes, so the scaled reservation over-provisions slightly at >100%; the slack lands on the label, which is exactly where the clipping happened. Below 100% the chip shrinks proportionally, matching its content.

Verification

  • test/composer-chip-descenders.test.mjs — 5/5 pass; the "mode selector reserves the longest localized label width" contract now pins the calc(96px * var(--font-scale, 1)) form for all four properties instead of the fixed 96px.
  • Arithmetic check at the reported settings: 115% → 110.4px reservation − 20px padding − 14px icon − 12px gaps − 12px caret = 52.4px label space vs the 41.4px the zh label needs; 125% → 62px vs ~45px.

One commit on current main (4bedbb4).

The trigger reserved a fixed 96px while its label multiplies --font-scale, so at 115% the localized mode name clipped to a single character plus an ellipsis. Scale the reservation with the same token; the fixed-size icon and caret leave the slack on the label, which is where clipping happened (vastsa#1866).
@vastsa
vastsa merged commit 94061cd into vastsa:main Oct 25, 2026
6 checks passed

This branch was previously deployed

1 inactive deployment
Preview — 0766bf72 Deployed Oct 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 字体大小「超大杯」(115%) 下,Composer 模式按钮把「智能体」截成「智…」(.composer-mode-chip 宽度写死 96px)

2 participants