Skip to content

File > New: keep the template tiles inside the right margin in a narrow window - #1471

Merged
h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
Harrison-Booth:dc-small-pr-checks
Oct 30, 2026
Merged

h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
Harrison-Booth:dc-small-pr-checks

Conversation

@Harrison-Booth

@Harrison-Booth Harrison-Booth commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1421.

Cause. backstage.rs called ui.set_max_width(CONTENT_W) (1180) inside the page frame. In egui that also widens: when the window is narrower than 1180 points, the page grows past its 36pt right margin and the scroll area, so the last tile of each row is cut off at the screen edge (the "Paper" tile in the screenshot on the issue).

Fix. ui.set_max_width(ui.available_width().min(CONTENT_W)), the same clamp recent_list already uses.

What ran. Linux only, headless egui_kittest (no real window, no WSLg screenshot, no Windows or macOS run):

  • New test new_tiles_keep_the_right_margin_in_a_narrow_window renders File > New at 1000 points wide. Without the fix it fails ("Nocturne ends at 1136"); with the fix it passes.
  • cargo test -p deckcraft-ui-egui --lib backstage: 26 passed.
  • cargo fmt --check and cargo clippy -p deckcraft-ui-egui --tests -- -D warnings: clean.
  • Not run: the full workspace suite (CI will).

Summary by CodeRabbit

  • Bug Fixes
    • The Backstage page content now fits within narrower windows, preserving a consistent right margin for template tiles.

…torytold#1421)

set_max_width(CONTENT_W) widened the page past the margin whenever the window was
narrower than CONTENT_W, so the last tile in each row ran off the screen edge.
@coderabbitai

coderabbitai Bot commented Oct 28, 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 55e5ee5 and b5928a1.

Files selected for processing: 2
  • crates/ui-egui/src/backstage.rs
  • crates/ui-egui/src/backstage/tests.rs

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

Walkthrough

The Backstage page now caps its content width to the available width when that width is below CONTENT_W. A new test checks template tile margins in a 1000-point-wide window.

Changes: Backstage layout

Layer / File(s) Summary
Content width and layout validation
crates/ui-egui/src/backstage.rs, crates/ui-egui/src/backstage/tests.rs
The content width is capped at the smaller of the available width and CONTENT_W. A new test checks that seven template tiles stay within the 36-point right margin in a 1000-point-wide window.

Priority: Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Severity of issue fixed: Low

Suggested reviewers: aiongg

Merge Risk: Minimal · up to b5928

The focused layout change is supported by source inspection and targeted test coverage, with no concrete merge-blocking risk identified.

Architecture risk: Low · up to b5928

The change affects 1 system.

Changed systems: crates

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/ui-egui/src/backstage.rs: The content width maximum now uses the smaller of the available width and CONTENT_W; previously it used CONTENT_W unconditionally. The accompanying comment describes clipping in narrower windows.
  • observed — Modified behavior in crates/ui-egui/src/backstage/tests.rs: Adds a narrow-window layout test that opens the New page in a 1000-point-wide harness and checks that each of seven named tiles stays within the 36-point right margin.
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and specifically describes the main change: keeping template tiles within the right margin in a narrow File > New window.
Linked Issues check Passed Issue [#1421] requires space between the screen edge and the template list on the new-document page. backstage.rs now clamps the page width with ui.available_width().min(CONTENT_W). The added `new…
Out of Scope Changes check Passed The pull request changes only the new-document page width calculation and adds a focused regression test for issue [#1421]. The changes support the stated objective and show no unrelated behavior or f…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

Issue [#1421] requires space between the screen edge and the template list on the new-document page. backstage.rs now clamps the page width with ui.available_width().min(CONTENT_W). The added new_tiles_keep_the_right_margin_in_a_narrow_window test verifies that seven template tiles end at or before 964 points in a 1000-point window.

Full details: Out of Scope Changes check

Explanation

The pull request changes only the new-document page width calculation and adds a focused regression test for issue [#1421]. The changes support the stated objective and show no unrelated behavior or files.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.

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.

@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit 6030fb4 into storytold:main Oct 30, 2026
1 check passed
@echelon

echelon commented Oct 30, 2026

Copy link
Copy Markdown
Member

Landed on main, thank you @Harrison-Booth for the contribution! If you haven't already, come join us on Discord: https://discord.gg/artcraft

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.

scaling of windos wrong on the page to create a new document

3 participants