From 7bdda04509d375f88d6c7743feef43857a302bae Mon Sep 17 00:00:00 2001 From: yetone Date: Mon, 16 Nov 2026 09:43:49 +0800 Subject: [PATCH] settings: Update source's menu button shows its whole name (jiangshangmuyun on X) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Settings › About › Update source showed only a clipped glyph and the chevron (reported on Windows, reproduced in Chromium and WebKit alike). Cause: .pref-pick's max-width is min(230px, 45%), meant for a picker that is the row's own child (Language). Update source's button sits in the row's .val box, whose width is its content's, so 45% resolved against the button's own width and shrank it each time. A .pref-pick inside .val now takes min(230px, 100%); .val is held to 60% of the row already. Only #updateSourcePick sits there (langPick and the sidebar pages picker are the row's own children), so nothing else moves. settings-update-source.test.cjs now checks the label is not clipped for each of its three choices. Run (mote): - settings-update-source.test.cjs on the old CSS: 10 of 20 red (every language at 1100px in chromium and webkit, e.g. "自动: the label is clipped (24px in 0px, button 25.6px)"); with the fix 20 of 20 ok. - node --test settings-update-source, segs-glide, uninstall-settings, update-mirror, update-download-steps, update-hide, update-quiet, update-row-steady, update-check, i18n-keys: 300 of 300 ok (both engines, every language). - go test -run 'Budget|CSS|Asset|I18n' ./internal/gui: ok. gofmt clean. Not tried: the real Windows app (WebView2); the whole GUI suite, as the rule matches one element. --- internal/gui/assets/app.css | 4 ++++ internal/gui/tests/settings-update-source.test.cjs | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index 5c8587dc9..0f54077c5 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -4310,6 +4310,10 @@ img.nav-ic { border-radius: 3px; object-fit: contain; } #otelList .otel-env { padding: 12px 14px; border-top: 1px solid var(--line-2); font-size: 11.5px; color: var(--muted); } .session-terminal-select, .pref-pick { max-width: min(230px, 45%); height: 26px; color: var(--fg); } +/* inside a row's value box, whose width is its content's, 45% of it would + shrink the button to a clipped glyph (jiangshangmuyun on X); the box is + held to 60% of the row already */ +.val > .pref-pick { max-width: min(230px, 100%); } .session-terminal-select:focus-visible, .pref-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } .row.pref .segs { flex: none; margin-left: auto; } .proxy-segs { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-left: auto; min-width: 0; max-width: 100%; } diff --git a/internal/gui/tests/settings-update-source.test.cjs b/internal/gui/tests/settings-update-source.test.cjs index 555a5e378..dde4e83a9 100644 --- a/internal/gui/tests/settings-update-source.test.cjs +++ b/internal/gui/tests/settings-update-source.test.cjs @@ -100,8 +100,22 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(posts.at(-1).proxy, "direct", "the global proxy stays as it was"); await page.waitForFunction((word) => document.querySelector("#updateSourcePick")?.textContent === word, name); }; + // the button is as wide as its name (jiangshangmuyun on X, Windows): + // a percentage width inside the row's value box shrank it to a + // clipped glyph and the chevron + const fits = async (name) => { + const m = await pick.evaluate((b) => { + const s = b.querySelector("span"); + return { span: s.getBoundingClientRect().width, text: s.scrollWidth, pick: b.getBoundingClientRect().width }; + }); + assert(m.text <= Math.ceil(m.span) + 1, `${name}: the label is clipped (${m.text}px in ${m.span}px, button ${m.pick}px)`); + assert(m.span > 0, `${name}: the label shows`); + }; + await fits(l.auto); await choose(l.github, "github"); + await fits(l.github); await choose(l.site, "site"); + await fits(l.site); await choose(l.auto, ""); // the menu ticks the one chosen await pick.click();