Skip to content

refactor(ui): measured Ribbon layout with priority-prefix overflow - #82

Open
Limdongcheng wants to merge 1 commit into
nmrtist:mainfrom
Limdongcheng:feat/ribbon-layout-foundation
Open

refactor(ui): measured Ribbon layout with priority-prefix overflow#82
Limdongcheng wants to merge 1 commit into
nmrtist:mainfrom
Limdongcheng:feat/ribbon-layout-foundation

Conversation

@Limdongcheng

Copy link
Copy Markdown
Contributor

Summary

  • Ribbon group and tile widths now come from real galley measurement through an injected measurer (headless-testable), replacing the per-character estimates that drift on CJK and long labels; the More overflow reservation is measured the same way instead of a fixed 86 px.
  • The overflow fill admits groups by priority and stops at the first group that does not fit, so the visible set is always the highest-priority prefix. Previously a wide high-priority group could land in More while narrower low-priority groups stayed visible.
  • Every (tab, group) pair has an explicit left-to-right order, guarded by an exhaustive test over the placement tables; roughly a third of the groups used to tie at u8::MAX and ordered by catalog-iteration accident (Data ▸ Export, Process ▸ Processing, Analyze ▸ Statistics, the Figure/Arrange property groups, …).
  • The screenshot harness gains Op::RibbonTab and captures every task tab at 900 px, so Ribbon changes have visual coverage beyond the Analyze tab.
  • ribbon.rs splits into ribbon/layout.rs + ribbon/buttons.rs, and the command roster moves to commands/roster.rs, keeping every file under the 800-line limit.

No intended visual change at today's widths apart from group order becoming deliberate.

Validation

  • cargo pr-check passes (fmt, file size, dependency policy, both frontends, clippy with denied warnings, tests).
  • New unit tests: group-order exhaustiveness over the placement tables, the overflow prefix property, and measured-density selection.
  • PLOTX_SHOT before/after at 720/900/1440 px in both themes.

UI display logic

  • New or changed actions go through the command catalog (CommandId +
    describe) and are searchable in the command palette. (No actions added;
    the roster extraction is code motion.)
  • Hiding happens only at Ribbon-group level (dataset kind or width
    budget); transient states disable with a disabled_reason that says how
    to unblock.
  • No layout changes from background events; panels are never auto-closed.
  • New panels or empty regions show an empty state with a next step. (None
    added.)
  • Docs updated in docs/ (English and zh-CN) for user-visible behavior.
    (No documented behavior changes in this PR.)

🤖 Generated with Claude Code

Split ribbon.rs into layout (width mathematics) and buttons (command
widgets) modules ahead of the labelled-compact work, and make the layout
engine measure instead of guess:

- Group and tile widths come from real galley measurement through an
  injected measurer, replacing the per-character estimates that drift on
  CJK and long labels; the More reservation is measured the same way
  instead of a fixed 86 px.
- The overflow fill now stops at the first group that does not fit, so
  the visible set is always a highest-priority prefix; previously a wide
  high-priority group could land in More while narrower low-priority
  groups stayed visible.
- Every (tab, group) pair has an explicit left-to-right order, guarded
  by an exhaustive test over the placement tables; half the groups
  previously tied at u8::MAX and ordered by catalog iteration accident.
- The screenshot harness gains an Op::RibbonTab scene op and captures
  every task tab at the in-between 900 px width, so Ribbon changes have
  visual coverage beyond the Analyze tab.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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