Skip to content

refactor(settings): merge font slots into three rows and trim filler hints - #169

Merged
Yangshifu1024 merged 2 commits into
mainfrom
refactor/settings-font-hints
Oct 16, 2026
Merged

Yangshifu1024 merged 2 commits into
mainfrom
refactor/settings-font-hints

Conversation

@Yangshifu1024

Copy link
Copy Markdown
Owner

背景

外观页的字体分组把三个槽拆成六行,每行都挂一行灰字说明 —— 实际只有两句话,各重复三遍。

其中有一处不只是废话,而是错的:

本机已安装的字体名,多个用逗号分隔;留空恢复默认,回车生效

字体提交有四条路径 —— 回车 / 失焦 / 停手约 600ms / 卸载。按不按回车都会存,这句会让用户以为必须敲回车。

另一条 12–20px,三组独立;默认界面 14px、内容 14px、代码 12px,改即生效 则是纯重复:范围点开下拉自明、默认值当前选中值与还原按钮都在,还专门在「内容字号」下复述另外两槽的默认值。

改动

去掉冗余说明

  • 删掉 fontSizeHint,改写 fontHint
  • 保留唯一无法自明的输入格式(逗号分隔 / 留空用默认),合并成一行挂在「字体」分段标题右侧

三槽合并成三行

  • 每行左侧只标槽名(界面 / 内容 / 代码),行内并排放字体族输入与字号 Select,下方一条预览
  • 合并的依据不只是省行数:同槽的字体族与字号原本各带一条预览行,而两条样本完全相同(同字体族 + 同字号),本就是纯重复
  • 两个控件各自保留锚点(ui.font_<slot> / ui.font_size_<slot>),设置搜索仍能分别定位

三处布局问题

  • 左列由 50% 半行宽改为定宽窄列 —— 那是说明文案较长时代的布局,标签只剩两个字后成了大片留白
  • 等高:字号 Select 原挂 size="small",antd 给它更小的上下内边距,比同行 Input 矮一截、下边线对不齐
  • 重置合并为行末一个按钮,一按清本槽字体族 + 字号;只提交一次,避免在串行队列里连发两轮

尺寸统一收进 SETTINGS_VISUAL,页体 CSS 不留字面量。

验证

pnpm prepr 全部硬步骤通过(合并 origin/main 后重跑过一次):

✓ lockfile  ✓ rust-fmt  ✓ rust-clippy  ✓ rust-test
✓ ui-lint   ✓ ui-test   ✓ ui-build    ✓ scripts-test

ui-test 1905 用例全通过。改动只涉及前端,rust-* 为回归确认。

测试侧新增了一条「一次点击 = 一次落盘」的断言,以及两条反模式契约(Select 不得挂 size="small"、重置不得藏在 suffix 里),防止这两个问题在后续改动中被改回去。

未在本 PR 内验收

界面改动按项目纪律不做 GUI 自动点验,以下需手动确认:三行结构与左侧标签垂直居中、三个控件等高、行末重置一次清两项、搜索跳转锚点、窄窗口堆叠、英文界面文案。另:本地仅覆盖 macOS,Windows 分支与 GUI 视觉仍以 CI / 人工验收为准。

…hints

The appearance page rendered six rows for three font slots, each carrying
its own gray hint line — the same two sentences repeated three times.

Content that was noise:
- "12–20px, set independently; defaults: UI 14px, content 14px, code 12px,
  applies immediately" restated what the Select, the current value, the
  reset button and the preview row already show, and repeated the other
  slots' defaults under each slot's own row.
- "applies on Enter" was simply wrong: a family commits on Enter, blur,
  ~600ms idle and unmount, so Enter is never required.

Layout:
- Merge each slot into one row (interface / content / code): family input
  and size Select side by side, one preview below. The old two previews per
  slot rendered the identical sample (same family + same size), so one of
  them was pure duplication.
- Both controls keep their own anchor (ui.font_<slot> /
  ui.font_size_<slot>), so settings search still locates either one.
- Left column drops from 50% to a fixed narrow column now that the label is
  two characters; the reclaimed space goes to the controls.
- Height mismatch fixed at the source: the size Select no longer carries
  size="small", which made it shorter than the Input beside it.
- One reset per row, at the far right, clearing both the family and the
  size of that slot. It submits once — the two commitFont* calls are
  chained but only the final state is persisted, avoiding two rounds
  through the serial queue.
- Shared guidance (comma-separated families, empty = default) now says it
  once in the section header instead of per row.

Dimensions live in SETTINGS_VISUAL so page CSS carries no literals.
@Yangshifu1024
Yangshifu1024 merged commit 5efdc83 into main Oct 16, 2026
11 checks passed
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.

1 participant