Skip to content

LR-BEHAV-LOCALIZE: the Color section's rows no longer widen the Edit panel (stacked on #2804) - #2883

Open
EduardoAndradeMachado wants to merge 2 commits into
storytold:mainfrom
EduardoAndradeMachado:color-section-panel-width
Open

EduardoAndradeMachado wants to merge 2 commits into
storytold:mainfrom
EduardoAndradeMachado:color-section-panel-width

Conversation

@EduardoAndradeMachado

@EduardoAndradeMachado EduardoAndradeMachado commented Oct 25, 2026 •

Copy link
Copy Markdown

Stacked on #2804: it uses that PR's widgets::text_button_size. Only the last commit (d87ee41c) is this one's own.

Problem

In longer languages the Edit panel's content runs past its right edge. Sliders, their values, buttons and the Color Mixer's chevron end under the tool strip, and the White Balance mode is cut off by the panel (Portuguese "Como capturado ›" in the screenshot below).

The cause is the one #1762 fixed for long profile names. egui grows the content to its widest row, so one row wider than the panel widens everything below it. Three rows in the Color section do that:

  • The Color Mixer's targeted-adjustment row (Hue / Saturation / Luminance). It reaches into the right margin in 13 of the 18 languages at the default 270 pt, English included, and in 14 at the narrowest 250 pt.
  • The White Balance row (label, mode, eyedropper). It reaches into the margin for 33 language/mode pairs at 270 pt and 60 at 250 pt.
  • The eight colour swatches. They need 211 pt, and the narrowest panel has about 202 pt of content, so every language is affected at 250 pt.

Measured on #2804's head with the new test: some widget ends past the panel's right edge in 15 of the 18 languages at 270 pt, and in all 18 at 250 pt.

Change

All three changes are in crates/ui-egui/src/panels/edit.rs.

  • Targeted-adjustment row. The gaps narrow, from 6 down to 2 pt, before a button wraps. A wrapped row starts after the target icon, like the first one. The row is planned with text_button_size, as header_buttons does. English keeps its single row in the default panel.
  • White Balance row.
    • Label and mode are cut short with … before the eyedropper (dropdown_within / one_line, as the profile row has done since LR-PROF-DROPDOWN: a long profile name no longer widens the Edit panel #1762).
    • The label gives way first, down to 40 pt, so the mode, which says what is set, stays whole where it can.
    • Both show their full text on hover.
    • The row never wraps, so the layout doesn't change with the selected mode.
  • Swatches. The gaps narrow only when the eight don't fit.

Not in this PR:

If you'd rather the White Balance label took a row of its own instead of being cut short, I'm happy to switch. I tried that first, but the layout then changed with the selected mode: in English at 270 pt, "Fluorescent" moved the label up and "As Shot" moved it back.

How it was checked

  • A test that fails without this change: tests_edit_layout::the_color_section_leaves_the_edit_panel_its_width_in_every_language.

    • It renders the right panel through right::show, so its border and scroll area take their share as in the app. It covers all 18 languages, at 250 and 270 pt, for every white balance mode (Custom included: the menu doesn't offer it, but dragging Temp or Tint sets it).
    • It asserts:
      • no widget ends past the panel's edge;
      • the White Balance menu ends before its eyedropper;
      • the label and the eyedropper stay on the menu's row;
      • the mode is cut short only once the label is at its floor;
      • the label is cut short only when its whole text, the menu and the eyedropper don't fit;
      • English at 270 pt shows every mode whole and As Shot's label whole;
      • a wrapped mixer row starts after the icon;
      • English keeps one mixer row at 270 pt.
    • It fails on fix(ui): wrap the Edit header buttons instead of letting Reset cover HDR #2804's head. The counts under Problem were taken there with the same rendering.
  • Planted bugs, one at a time in the production code; each turned the test red:

    Planted bug What the test reported
    No wrapping in the mixer row Luminance past the edge (English, 250 pt)
    Fixed 5 pt swatch gap Section headers past the edge (250 pt)
    Fixed 6 pt button gap English wraps at 270 pt
    No 0.5 pt slack in the "fits on one row" check English wraps at 270 pt (the gap that exactly fills the row overflowed on rounding)
    Wrapped row indented by the icon only Starts at 45 instead of 51
    Label never gives way English "Tungsten" cut short at 250 pt with room left in its label
    Label always at its floor English As Shot label cut short
    Mode without the ellipsis Russian "Tungsten" under its eyedropper at 250 pt
    Label cut 30 pt shorter than needed English As Shot at 250 pt: label cut though 199 pt fits the 202 pt row
  • A first version of the test rendered edit::show directly, without right.rs's border and scroll area. It passed while the app wrapped English. Measured in the app at 270 pt, the content is 222 pt, which is why the test now goes through right::show.

  • User-visible change: looked at the final code in headless snapshots, before and after (below). The desktop app was also run and checked by hand on an earlier revision of this branch.

  • Local checks, Windows 11:

Screenshots

Headless snapshots (lightcraft-cli snapshot --demo, 1400 × 900, right panel at its default 270 pt). Before is #2804's head; After is this branch.

Portuguese:

Before and after, Portuguese

English: one mixer row as before, with slightly narrower gaps.

Before and after, English

Merging

Summary by CodeRabbit

  • Style
    • The Edit panel header buttons now wrap when space is limited, with Reset aligned to the right edge of its row.
    • White Balance labels and controls fit the available width, with long labels truncated as needed.
    • Color Mixer spacing adjusts to panel width, and targeted-adjustment buttons wrap into aligned rows.
    • Layout behavior is checked across supported languages, panel widths, and white-balance modes.

Enthendor and others added 2 commits October 24, 2026 15:50
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>
…panel

In longer languages the Color Mixer's Hue / Saturation / Luminance row, the
White Balance row and the colour swatches were wider than the panel. egui grows
the content to its widest row, so the sliders and buttons below them ran past
the panel's right edge, under the tool strip.

- Targeted-adjustment row: the gaps narrow (6 down to 2 pt) before a button
  wraps, and a wrapped row starts after the target icon like the first.
  English keeps its single row in the default panel.
- White Balance row: label and mode are cut short with an ellipsis before the
  eyedropper, the label first (down to 40 pt) so the mode stays whole where it
  can. The row never wraps, so its layout doesn't change with the mode.
- Swatches: the gaps narrow only when the eight don't fit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 38f8d25 and d87ee41.

Files selected for processing: 3
  • crates/ui-egui/src/panels/edit.rs
  • crates/ui-egui/src/tests_edit_layout.rs
  • crates/ui-egui/src/widgets.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The Edit panel now adapts header buttons, White Balance controls, and Color Mixer controls to available width. New layout tests check widget bounds, wrapping, alignment, and text elision across locales, panel widths, and white-balance modes.

Changes: Edit panel layout

Layer / File(s) Summary
Header button sizing and wrapping
crates/ui-egui/src/widgets.rs, crates/ui-egui/src/panels/edit.rs
A shared helper measures text button widths. Header buttons wrap when they do not fit, while Reset remains right-aligned. Tests check button bounds, overlap, and alignment across locales and widths.
White Balance and mixer layout
crates/ui-egui/src/panels/edit.rs, crates/ui-egui/src/tests_edit_layout.rs
The White Balance label and dropdown fit the available row width. Mixer spacing adapts to panel width, and targeted-adjustment buttons wrap. Tests check layout and text elision across locales, widths, and white-balance modes.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: marcoarnulfo

Merge Risk: Minimal · up to d87ee

The elided label remains readable on hover, and no unresolved issue identified here prevents merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the primary change: preventing Color section rows from widening the Edit panel. It is specific and relevant to the pull request.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.99.0)

Clippy execution timed out

Comment @coderabbitai help to get the list of available commands.

@wanikhawar wanikhawar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is stacked on #2804 and conflicts with main now. Please rebase once #2804 has landed.

@wanikhawar

Copy link
Copy Markdown
Contributor

This conflicts with main (edit.rs, and the test file moved to tests/edit_layout.rs). Only d87ee41c is yours; #2804 is merged, so please rebase onto main and drop the copy of it. Since the framework port, the White Balance row is color_controls::preset and the colour swatches are mixer_band_picker (Craft Swatch), so two of the three hunks no longer touch the code that overflowed; please re-measure each language at 250/270 pt on current main and keep only the rows that still overflow. The targeted-adjustment row (Hue/Saturation/Luminance) is now in panels/edit/mixer.rs (mixer_by_color) and that hunk needs moving there. Please put the new test in tests/edit_layout.rs.

This branch has not been deployed

No deployments
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.

3 participants