Commit Graph
3 Commits
Author SHA1 Message Date
Dylan M. Taylor 6a66b95cbc Enforce Rust coding standards via Clippy (#372)
* chore(lints): enforce workspace Clippy standards

Deny cognitive_complexity (threshold 30, rust:S3776), too_many_arguments and wildcard_imports workspace-wide. Existing violations are fixed in follow-up commits.

* refactor(keymap): isolate shortcut row rendering

* test(ui): cover dock command contract cases

* fix(keymap): remove unused shortcut layout state

* refactor(media): simplify container serialization tests

* docs: document workspace lint inheritance for new crates

* refactor(text): split Knuth-Plass line costing and path extraction

Brings knuth_plass under the workspace cognitive complexity limit.

* test(font-store): split lookup test by concern
2026-10-27 13:49:38 -04:00
aiongg 92d392cff1 craft-ui: ComboBox, egui's combo box with a menu that grows back (#387)
* craft-ui: combo boxes whose menu grows back with its contents

egui's ComboBox lays its menu out in the height it had on the previous pass,
and its scroll area takes no more than that. A filtered list that shrinks (a
search with no matches) never grows back when the search is cleared
(emilk/egui#5225, #5138). craft_ui::combo::menu offers its contents the full
height on every pass; craft_ui::combo::combo draws the combo box button
around it. The Font Manager's Language, Script and Sample menus use it.

* craft-ui: combo and menu take the close behaviour

A menu with a search field that closes itself on a pick (DesignCraft's font
menu) closes on a click outside only.

* craft-ui: ComboBox, a drop-in for egui's combo box, with header menus

craft_ui::ComboBox has egui 0.37's ComboBox builder and button (same
atoms, style classes and icon, pixel-identical in a test) with a menu that
grows back. show_ui_with_header and show_rows_with_header keep a search
field in place and scroll only the list; combo::Menu is the same menu under
a field an app draws itself. clippy.toml disallows egui::ComboBox.

The Font Manager's Language menu, the keymap dialog's combo boxes and the
print dialog's printer and duplex choices use it.

* craft-ui: combo menus keep to the room on their side, and footers

A menu is never taller than the room on the side of its field it opens on,
so an unbounded height fits on screen and scrolls. The side is settled once
the menu is measured and kept while it is open, so a menu that shrinks or
grows while typing doesn't jump to the other side of its field.

Footer forms keep a row under the scrolling list. Menu::new takes the
field's Ui for its default height and frame, and Menu::open shows the menu
under a text field that keeps the focus while typing.

* craft-ui: combo menus open by the app keep their side, and take picks

Menu::open takes &mut bool: the menu clears it when it closes (close
behavior, Escape, ui.close(), the field losing the focus to anything but
the menu), so a click on a row under a focused text field is picked.

The side settles only once the menu was shown and measured, also for
menus the app opens (Popup::open_id). A footer that changes height
remeasures the menu before it is shown. The popup frame's margins come
from the popup style; only above/below alignments are tried.

* craft-ui: a resting pointer over a combo menu doesn't keep it open

The menu counts the pointer as having moved into it only on a press or
click. A footer height change also requests a repaint, in case the
discard is denied.

* craft-ui: a footer menu opens without a second sizing pass

A footer height change no longer discards the pass or forces another
sizing pass: the menu measures again on the next pass and settles its
side then. A forced sizing pass ran a search field's focus request in a
pass where the field can't take the focus, so a footer menu opened with
the search unfocused.

* craft-ui: tests use Ui::scope_id

* craft-ui: hide the measuring pass of a footer menu, cap remeasures

The pass that measures a menu before its side is settled is laid out but
drawn fully transparent, so no frame shows a side or height the menu then
leaves. A footer that changes height on every pass remeasures twice per
open, then settles.

* craft-ui: tests satisfy clippy
2026-10-27 09:21:01 -04:00
Brandon ThomasandClaude Opus 5.5 3a791fdc41 Rust workspace and MIT OR Apache-2.0 license (#1)
License files match the craftrules licensing standard; empty Cargo workspace
(crates/*) with shared package fields and lints.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:02:40 -04:00