Repository navigation
fix(ui): wrap the Edit header buttons instead of letting Reset cover HDR - #2804
Conversation
Reset was laid out right-to-left in whatever width Auto, B&W and HDR left, so a long label drew over HDR: German Zurücksetzen in the default panel, and 16 of the 18 languages at some panel width. A button that doesn't fit now starts the next row; Reset stays right-aligned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Button width measurement crates/ui-egui/src/widgets.rs |
text_button uses a shared width formula. The new public text_button_size function measures translated labels using the button font and text color. |
Edit header action layout crates/ui-egui/src/panels/edit.rs |
The header lays out Auto, B&W, and HDR in rows. Reset shares the last row when it fits; otherwise, it occupies a right-aligned row. Existing action handling remains in place. A test checks layout across locales and widths. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- storytold/lightcraft#2079: Changes the same Edit header actions by moving them to the shared Button component.
- storytold/lightcraft#2689: Replaces the same Edit-panel controls with shared Button widgets.
Suggested reviewers: claude
Merge Risk: 
Minimal · up to d0670
-
The Edit header buttons wrap without an identified overlap or edge-overflow issue. The change is ready to merge after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed -
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
FredApps
left a comment
There was a problem hiding this comment.
Source review at d0670de (base main 5194cc2). I read the whole diff: panels/edit.rs, widgets.rs and the new test.
I found no functional defect. The row planning is right: used after the loop is the width of the last row, so reset_on_last correctly decides whether Reset shares that row or gets its own; text_button_size and text_button share text_button_width, so the planned and drawn widths agree; the click flags are set once per frame; and the test measures all four buttons across every locale at 200, 222, 260 and 400 pt, checking edge overrun, pairwise overlap and Reset's right alignment.
One small thing to fix while you are in the file: the new HeaderClicks struct was inserted between the existing doc comment /// The Reset button's tooltip with the reset shortcut ... (issue #1751). and fn reset_tip. That line now documents HeaderClicks (above its own doc line) and reset_tip has lost its doc. Move the new items above that comment.
Not verified: the test needs the font and headless harness, which I did not run. The PR conflicts with main, so CI has not run on it and I cannot approve it. Please rebase onto current main; once it is mergeable and CI has run on the merged head, I will re-check and approve if it is green.
Edit panel: Reset no longer covers HDR in longer languages
Noticed while reviewing the German catalog (#2800). In the Edit header, Reset was laid out right-to-left in whatever width Auto, B&W and HDR left. With a longer label it drew on top of HDR. In German at the default panel width only "HD" was visible.
The new test measured how widespread this was:
Change
header_buttons(inpanels/edit.rs) plans the row before drawing it. A button that doesn't fit starts the next row, and Reset stays right-aligned on whichever row it lands.widgets::text_button_sizegives atext_button's width ahead of drawing.text_buttonuses the same formula, so the plan and the drawn row always agree.Tests
edit_header_buttons_do_not_overlap_in_any_language, checked for everyLocale::ALLat widths 200, 222, 260 and 400 pt:cargo clippy -p lightcraft-ui-egui --all-targets -D warningsclean.cargo test -p lightcraft-ui-egui: 1389 passed. The 6tests_model_setupfailures also occur without this change: my local build "cannot run denoise models".lightcraft-cli snapshot --demo, de/en/it) checked by eye:🤖 Generated with Claude Code
Summary by CodeRabbit