Skip to content

feat(theme): a cell density, for a renderer that paints into a terminal's cells - #10

Merged
adammharris merged 5 commits into
mainfrom
dioxus-tui
Oct 21, 2026
Merged

adammharris merged 5 commits into
mainfrom
dioxus-tui

Conversation

@adammharris

Copy link
Copy Markdown
Member

For leaf's terminal prototype (diaryx-org/leaf#20), which paints a Blitz page into character cells and puts unit's menus and dialogs round the editor, as the Mac app does.

  • Density::Cell: every row a menu or a dialog has is one cell (24px) high, in the host's monospace Theme::font, with square corners and no shadows. Metrics::CELL and menu::Sizes::CELL are kept in step with the stylesheet by the existing test.
  • Sizes gains margin and overlap, 4px each for the pointer and touch densities as before. The cell density keeps to the grid: no margin, and a submenu overlapping its parent by one cell.
  • Unit::hot_first is public, for a host that opens a menu from a key.
  • An action sheet can be answered from the keyboard: ↑/↓ or Tab move a highlight through its actions and Cancel, and Return or Space chooses. Behavioural change: an open sheet acts on those keys, which it used to swallow.

Theme, Sizes and ActionSheet each gain a field, so one written out field by field needs it added.

Checks: ship ci (fmt, clippy, web clippy, tests, docs) passes.

…al's cells

Density::Cell makes every row a menu or a dialog has one cell high (24px, Metrics::CELL and menu::Sizes::CELL, kept in step with the stylesheet by the existing test), with square corners and no shadows. A menu's padding leaves a row above and below its items for the border. The host sets Theme::font to its monospace face. Theme gains a `cell` field, so a Theme written out field by field needs it added.
Sizes gains margin and overlap, 4px each for the pointer and touch densities as before. The cell density keeps to the grid: no margin, a submenu overlapping its parent by one cell, and a pad that counts the 1px border, so a level is exactly as tall as its rows. Sizes gains two fields, so a Sizes written out field by field needs them added.
↑ and ↓ (or Tab and ⇧Tab) move a highlight through the sheet's actions
that can be chosen and its Cancel, round from the end; Return or Space
chooses the one highlighted. Until a key moves it nothing is highlighted,
so Return on a sheet just opened still does nothing. The cell density
centres the sheet and gives each action one row.

ActionSheet gains a `hot` field, so a sheet written out field by field
needs it added.

Behavioural-change: an open action sheet acts on ↑, ↓, Tab, Return and Space, which it used to swallow.
@adammharris
adammharris marked this pull request as ready for review October 21, 2026 23:17
@adammharris
adammharris merged commit b1390d3 into main Oct 21, 2026
6 checks passed
@adammharris
adammharris deleted the dioxus-tui branch October 30, 2026 01:26
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