From 46176fc14f3104a16d880d1dfd3646aa84688022 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 22 Oct 2026 17:35:17 +0800 Subject: [PATCH] settings: every row has its line and the same room above and below its words MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The owner (10-22, a screenshot of Settings → General): no line above "Open at login", and the rows' space above and below differed. - The line between rows is `.row + .row`; Settings' agent-pref link box (#agentPrefLinks, empty but while searching) sits between "Provider in model names" and "Open at login", so that row had none. The row after the box, and the box's own first row, now get it. - In the window every row had `body.window .row`'s 7px, which beat `.row.pref` on specificity: one-line rows were centred by min-height (13-15px around their words), a row with a line under its name had 7-8px. Every settings row now has 12px above and below; the Language and Session terminal buttons are 26px as the segments are, so every one-line row is 51px and a two-line row 61px, in both engines. - A row's new line now grows it ~12px (was 1-2px under min-height). hold() kept a view at its top only while the clicked control moved less than half its height, so turning automatic updates off scrolled About 12px (#2134 says the view stays at its top). The bound is now the control's height; #961's ~138px stage still holds the bar. - turn-done, reset-reminder and usage-alert clicked a switch left under the window's foot or the tabs; Playwright's scroll to it read as the page moving. They now reach() it first; update-restart's at-top bound is "less than the switch's height", not 4px. Run at this tree (worktree magpie-wt/setrows, base 86254d404): - settings-general: 20/20 (chromium+webkit, 5 languages, 1000/440). Red with the old CSS (fullContextRow 7px above), and red with only the line rule taken out ("loginRow has no line above it"). - The 94 GUI files that touch settings rows: 1559 pass, 61 red; against the old CSS 56 of them passed. Those 56 are fixed above: update-restart + update-auto 32/32, turn-done + reset-reminder + usage-alert 36/36. mobile-web's desktop screenshots differ from origin/main by design (the change itself). - Red on the old CSS too: s3-sync (webkit en), usage-checkin (webkit en, zh). - go test ./internal/gui ok. Not run before push: the whole GUI suite (830 files) is running now; reds it finds go in their own commits. --- internal/gui/assets/app.css | 10 ++++++++-- internal/gui/assets/app.js | 10 ++++++---- internal/gui/tests/reset-reminder.test.cjs | 16 +++++++++++----- internal/gui/tests/settings-general.test.cjs | 16 +++++++++++++++- internal/gui/tests/turn-done.test.cjs | 16 +++++++++++----- internal/gui/tests/update-restart.test.cjs | 11 ++++++----- internal/gui/tests/usage-alert.test.cjs | 5 ++++- 7 files changed, 61 insertions(+), 23 deletions(-) diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index 97c5c93f2..268d7c613 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -555,6 +555,9 @@ body.panel .list { border: 0; border-radius: 10px; box-shadow: var(--card-edge); .row { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 5px 9px 5px 11px; } body.window .row { min-height: 48px; padding: 7px 12px 7px 14px; gap: 12px; } .row + .row, .editor + .row, .row + .editor { border-top: 1px solid var(--line-2); } +/* Settings' agent-pref link box sits between two rows, empty but for a search: + the row after it, and its own first row, still get their line (the owner, 10-22) */ +#agentPrefLinks + .row, .row + #agentPrefLinks > .row:first-child { border-top: 1px solid var(--line-2); } .row .ic { width: 18px; height: 18px; } body.window .row .ic { width: 22px; height: 22px; } .row .name { font-weight: 500; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; } @@ -3411,7 +3414,10 @@ body:not(.side-nav) #view-settings .set-head.stuck::before { box-shadow: 0 1px 0 /* a built-in page a plugin's page replaces steps aside in the sidebar */ #nav button[data-replaced] { display: none !important; } img.nav-ic { border-radius: 3px; object-fit: contain; } -.row.pref { min-height: 50px; padding: 8px 12px 8px 14px; gap: 14px; } +/* one space above and below every row's content, a row with a line under its + name too: the window's 7px for every row made those read cramped beside the + one-line rows, which min-height centred (the owner, 10-22) */ +.row.pref, body.window .row.pref { min-height: 48px; padding: 12px 12px 12px 14px; gap: 14px; } .row.pref .who { flex: 1 1 auto; } .row.pref .sub { margin-top: 2px; color: var(--fg-2); } .row.pref.font-row { flex-wrap: wrap; gap: 8px 14px; } @@ -3439,7 +3445,7 @@ img.nav-ic { border-radius: 3px; object-fit: contain; } #otelList .otel-stacked .segs { margin-left: 0; max-width: 100%; flex-wrap: wrap; } #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: 29px; color: var(--fg); } +.session-terminal-select, .pref-pick { max-width: min(230px, 45%); height: 26px; color: var(--fg); } .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/assets/app.js b/internal/gui/assets/app.js index 710a54f10..309464e02 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -23882,10 +23882,12 @@ function hold(h) { // what was clicked moves it down rather than scrolling the view to follow // it. Turning automatic updates off grew the Version row above the // switch once the save answered, and the view slid 2px off its top (#2134). - // Only while what was clicked stays under the pointer, moved by less than - // half its height: a day picked on Routing brings its stage in above the - // bar (~138px), and the bar is held where it was clicked (#961) - if (h.top && want > 0 && Math.abs(d) < a[0].getBoundingClientRect().height / 2) want = 0; + // Only while what was clicked moved by less than its height, a line come + // in above it: a day picked on Routing brings its stage in above the bar + // (~138px), and the bar is held where it was clicked (#961). Half its + // height was too little once a settings row kept 12px above and below its + // words: the Version row's line grew it 12px past a 22px switch (10-22) + if (h.top && want > 0 && Math.abs(d) < a[0].getBoundingClientRect().height) want = 0; // a view at its top when clicked stays there rather than be given room // to scroll down: a chip saved in the panel's Profiles came in above the // button held, and room made for the button slid the chip up under the diff --git a/internal/gui/tests/reset-reminder.test.cjs b/internal/gui/tests/reset-reminder.test.cjs index 6a832ff03..60b112be1 100644 --- a/internal/gui/tests/reset-reminder.test.cjs +++ b/internal/gui/tests/reset-reminder.test.cjs @@ -9,7 +9,7 @@ const fs = require("node:fs/promises"); const path = require("node:path"); const { test } = require("node:test"); const { chromium, webkit } = require("playwright"); -const { watchSettingsReads, settingsDrawn } = require("./reader.cjs"); +const { watchSettingsReads, settingsDrawn, reach } = require("./reader.cjs"); const assets = path.resolve(__dirname, "../assets"); @@ -83,19 +83,25 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await page.locator("#resetReminderSegs .opt.on").textContent(), w.off); assert.equal(await page.locator("#resetReminderRow select").count(), 0); - await page.locator("#resetReminderRow").scrollIntoViewIfNeeded(); - await page.waitForTimeout(200); - const top = await page.locator("#view-settings").evaluate((v) => v.scrollTop); + // each control wheeled wholly into sight, clear of the tabs and the + // window's foot, before it is clicked: Playwright's own scroll to one + // cut off moved the page, not the click (10-22, taller rows) + const scrolled = () => page.locator("#view-settings").evaluate((v) => v.scrollTop); + await reach(page, opts.nth(2)); + let top = await scrolled(); await opts.nth(2).click(); assert.equal((await posted(1)).resetReminder, 24); await page.waitForTimeout(300); assert.equal(await page.locator("#resetReminderSegs .opt.on").textContent(), w.h(24)); + assert.equal(await scrolled(), top, "the click moved the page"); // another setting saved later keeps it + await reach(page, page.locator("#currencySegs .opt", { hasText: w.cny })); + top = await scrolled(); await page.locator("#currencySegs .opt", { hasText: w.cny }).click(); assert.equal((await posted(2)).resetReminder, 24, "kept by another save"); await page.waitForTimeout(300); - assert.equal(await page.locator("#view-settings").evaluate((v) => v.scrollTop), top, "no click moved the page"); + assert.equal(await scrolled(), top, "no click moved the page"); await opts.nth(0).click(); assert.equal((await posted(3)).resetReminder, 0, "Off saves 0"); diff --git a/internal/gui/tests/settings-general.test.cjs b/internal/gui/tests/settings-general.test.cjs index e2d85e00d..3a6358a3b 100644 --- a/internal/gui/tests/settings-general.test.cjs +++ b/internal/gui/tests/settings-general.test.cjs @@ -12,7 +12,11 @@ // - Language is a button (never a native