Skip to content

LRC-LIB-LIBFOLDERS: the sidebar trees narrow their indent step before names are cut (#2298) - #2349

Merged
aiongg merged 5 commits into
storytold:mainfrom
helgehelge123:sidebar-adaptive-indent
Oct 22, 2026
Merged

aiongg merged 5 commits into
storytold:mainfrom
helgehelge123:sidebar-adaptive-indent

Conversation

@helgehelge123

@helgehelge123 helgehelge123 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2298.

A library below a deep path (/Users/<me>/Library/CloudStorage/<cloud>/RAW/<club>/<date>/RAW) puts its folders nine or ten levels down. At 16 pt per level the deepest names were cut to 2026-0… in the default panel and to … in a narrow one, and their counts went past the edge.

Default panel (268 pt): before / after Narrow panel (220 pt): before / after

Headless renders of the same library before and after this change.

What it does

  • Every level still steps right of its parent, in every sidebar tree (Albums, Local, By Date, Folders, Keywords). Only the size of the step changes.
  • The step follows the panel. It is 16 pt while the deepest open row keeps about 80 pt for its name plus room for its count. When it would not, the step is 14, 12, 10 or 8 pt, whichever is widest and still fits. A wide panel or a shallow tree looks exactly as before.
  • Bands, not a continuous value, so rows don't slide sideways at every point the panel edge is dragged.
  • Below 8 pt it stops narrowing, and the sidebar scrolls sideways as it does today (6f33aac). The deep-chain test now uses 26 levels to keep covering that.
  • No jumping while scrolling. The deepest row counts whether it is drawn or passed over out of sight (out_of_sight), so the step depends on what is open, not on what is scrolled into view. Like the content width, it is taken from the last frame.

How

Callers keep passing indents in 16 pt steps (INDENT_STEP), so the tree walks, the Local depth limit and the indent == 0 checks are unchanged. indent_x maps a nominal indent to the drawn one. It is used for the icon, name, chevron, album drop line and row_need. drawn_indent also records the deepest indent of the frame, and step_for(panel width, deepest) picks the next frame's step.

Decisions worth a look

Verification

  • New headless tests in tests_panels.rs:
    • a_deep_library_path_narrows_the_indent_instead_of_cutting_the_names: the default panel narrows, levels are evenly spaced, the deepest name shows left of its count, nothing scrolls sideways, a 480 pt panel goes back to 16 pt, and a shallow tree keeps 16 pt.
    • the_indent_step_narrows_in_bands: the band choice.
  • a_deep_chain_keeps_its_nesting_and_the_sidebar_scrolls_sideways now uses a 26-level chain that doesn't fit even at 8 pt. It asserts the same things as before at the narrow step.
  • cargo xtask ci on macOS (M4 Pro): all 8 steps pass (fmt, clippy -D warnings, heif, test, parity, layers, assets, wasm).
  • docs/parity-checklist.md: LRC-LIB-LIBFOLDERS describes the step, plus a changelog row.
  • Not run: the desktop app itself. The screenshots above are headless renders.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Sidebar indentation now adapts to panel width and tree depth, adjusting from 16 points down to a minimum of 8 points to preserve space for folder names.
    • Shallow trees and wider panels retain larger indentation for readability.
    • Deep folder paths remain horizontally scrollable when needed.
    • Folder rows, expand/collapse controls, and drag indicators stay aligned with the adaptive indentation.
  • Documentation
    • Documented the adaptive sidebar indentation behavior in the library-folder checklist.

… names are cut (storytold#2298)

Every level of Albums, Local, By Date, Folders and Keywords still steps one
level right of its parent, but the step is chosen each frame from the panel's
width and the deepest open row: 16 pt while that row keeps about 80 pt for its
name and room for its count, else 14, 12, 10 or 8 pt. Past 8 pt the sidebar
scrolls sideways as before. Callers keep passing indents in 16 pt steps;
`indent_x` maps them to the drawn step for the icon, name, chevron, album drop
line and the width a row asks for.

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

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: storytold/lightcraft/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3666198d-4198-4452-9b2c-b07b968b8b3f
📥 Commits

Reviewing files that changed from the base of the PR and between e07c2bd and eb7513c.

📒 Files selected for processing: 1
  • crates/ui-egui/src/tests_panels.rs

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

📝 Walkthrough

The sidebar adjusts tree indentation from 16 pt down to 8 pt based on panel width and deepest row depth. Tree rows and album drop indicators use the selected step. Tests cover deep paths, resizing, shallow trees, and row selection. The parity checklist records the behavior.

Changes: Adaptive sidebar indentation

Layer / File(s) Summary
Calculate and apply adaptive indentation
crates/ui-egui/src/panels/left.rs
The sidebar tracks the deepest row and selects a step from 16, 14, 12, 10, or 8 pt. Rows and disclosure chevrons use the selected step. A changed step is stored and triggers a repaint.
Integrate indentation across trees
crates/ui-egui/src/panels/left.rs, crates/ui-egui/src/tests_panels.rs, docs/parity-checklist.md
Date, local-folder, album, library-folder, and keyword trees use shared indentation units. Tests cover deep paths, panel widths, shallow trees, minimum indentation, and selection. The checklist records the updated behavior.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant SidebarLayout
  participant TreeRows
  participant step_for
  participant eguiContext
  SidebarLayout->>TreeRows: Record deepest row depth
  SidebarLayout->>step_for: Select step from panel width and deepest depth
  SidebarLayout->>eguiContext: Store changed step and request repaint
  eguiContext->>SidebarLayout: Repaint and draw rows with selected step
Loading

Suggested reviewers: mattsivak

Merge Risk: ⚪ Minimal · up to eb751

Deep sidebar trees use narrower indentation when space is limited, while horizontal scrolling remains available if the minimum step is insufficient. The supplied headless coverage exercises deep, narrow, wide, and shallow layouts; no concrete merge-blocking risk is evident.

Architecture risk: 🔵 Low · up to eb751

The change affects 2 systems.

Changed systems: crates, docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

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

Before / after behavior

  • observed — Modified behavior in crates/ui-egui/src/panels/left.rs: Added indentation constants and helpers. indent_step reads the previous frame’s step, drawn_indent records the deepest tree level while converting logical indentation to the selected step, and step_for chooses the widest fitting step from 16, 14, 12, or 10 points, falling back to 8 points while reserving name and count space.
  • observed — Modified behavior in crates/ui-egui/src/panels/left.rs: row_sensed now converts logical indentation through drawn_indent, recording depth and drawing the row at the adaptive step.
  • observed — Modified behavior in crates/ui-egui/src/panels/left.rs: Out-of-sight rows now contribute their logical depth through drawn_indent before calculating required width.
  • observed — Modified behavior in crates/ui-egui/src/panels/left.rs: Disclosure chevrons now use the adaptive converted indentation instead of fixed pixel indentation.
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 concisely describes the main change: adaptive sidebar indentation that reduces the indent step before names are clipped.
Linked Issues check Passed The PR meets the coding requirements in #2298. left.rs selects shared 16, 14, 12, 10, or 8 pt indentation from panel width and deepest open indentation. It applies the drawn step across sidebar rows…
Out of Scope Changes check Passed The changes stay within #2298. They modify sidebar indentation, focused panel tests, and the related parity checklist entry. The test-fixture changes support verification of the adaptive indentation b…
Docstring Coverage Passed Docstring coverage is 86.36% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 2 files.
Full details: Linked Issues check

Explanation

The PR meets the coding requirements in #2298. left.rs selects shared 16, 14, 12, 10, or 8 pt indentation from panel width and deepest open indentation. It applies the drawn step across sidebar rows and related layout elements. The tests cover deep paths, band selection, wide panels, shallow trees, nesting, and horizontal scrolling below the minimum step.

Full details: Out of Scope Changes check

Explanation

The changes stay within #2298. They modify sidebar indentation, focused panel tests, and the related parity checklist entry. The test-fixture changes support verification of the adaptive indentation behavior. No unrelated change is established.

✨ 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.

@rahul05ranjan rahul05ranjan 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.

The thing I most wanted to check in this diff was the indent flow, because there are now two scaling paths (drawn_indent inside the row functions, indent_x inside the chevron/drop-indicator functions) and a double-scale would have made chevrons drift left of their rows. It's clean: row_sensed and out_of_sight scale their own local copy, while disclosure_chevron, tree_toggle and album_drag_over all receive the raw caller indent and scale once internally. The row_need inside row_sensed also uses the scaled value, so the measured content width matches what is actually drawn — which is why the 26-level test can assert the scrollbar appears exactly when the 8 pt floor is reached.

I verified step_for's arithmetic against the band test values and they all agree: at a 268 pt panel, room is 88 pt, so 5 levels keep 16 (80 ≤ 88), 7 land on 12 (84 ≤ 88), 9 drop to 8 (90 > 88 at 10 pt), and 30 stay at 8 with scrolling taking over. The discrete-band choice is the right one — a continuous step would make every row slide sideways while the panel is being dragged.

Two observations, neither blocking:

  1. Since the step is global across all sidebar trees, a deep Keywords or By Date section narrows the Folders and Album steps too. The parity row documents this ("the same for every tree"), and the out-of-sight rows counting toward the deepest indent means it doesn't twitch while scrolling — but it does mean opening one very deep tree reflows every other tree in the panel. If that ever feels jarring in practice, per-tree steps would be the knob — though the shared rule is simpler and matches the shared scrollbar, so I'd only change it on evidence.
  2. date_rows still uses the literal 32.0 for the day level while the neighboring 16.0 literals became INDENT_STEP. It's correct while the constant is 16, just one step off the pattern the rest of the diff establishes.

The tests do the heavy lifting nicely: the headless before/after renders in the issue, the band table, the wide-panel restore, and the shallow-tree untouched case cover the whole decision space of step_for.

…t a literal 32 pt

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

Copy link
Copy Markdown
Contributor Author

Thanks for the careful read, @rahul05ranjan.

  1. Fixed in 1399dcd: By Date's day rows now pass 2.0 * INDENT_STEP instead of the literal 32.0.
  2. Agreed. I'm leaving the step global for now: it matches the shared sideways scrollbar and keeps every tree on the same grid. If a deep tree reflowing the others turns out to be jarring in practice, a per-section step is a small change (record the deepest indent per section instead of per frame).

🤖 Addressed by Claude Code

…idebar-adaptive-indent

# Conflicts:
#	docs/parity-checklist.md
@nledford

Copy link
Copy Markdown
Contributor

Hi @helgehelge123, thanks for this. It touches the same spots as #1243 (Folders: a disk opens at the first folder that holds photos, and Show Parent Folder): row_sensed, folder_tree / folder_rows, the localDeeperNote row and a MIN_NAME_ROOM constant (36 pt there, 80 pt here), plus the deep-chain tests. #1243 drops the rows that only lead on, so the staircase your tests build mostly goes away for a library below a deep path, and your narrowing still helps genuinely deep trees; the two fit together. If #2349 lands first we will adapt #1243 (rename its constant, route its Local "Opens as its own place" note through drawn_indent, and rebase its tests). If #1243 lands first, the one-line change on your side is the tests: build the deep fixtures with a photo in every level (as deep_folders_app does there), because folders that only lead on get no row then.

…(ready for storytold#1243)

The two deep-chain tests now build their library with `deep_folders_app`, as storytold#1243 does: every
level holds a photo, so it has a row of its own and starts closed, and the test opens it. They
pass the same whether or not the sidebar passes over folders that only lead on.

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

Copy link
Copy Markdown
Contributor Author

Thanks @nledford, that plan works for me. I've already made the deep-chain tests independent of the order the two land in (e07c2bd): both now build their library with a deep_folders_app like the one in #1243 (a photo in every level, each level opened by its chevron), so they pass with and without the pass-over of folders that only lead on. If #1243 lands first, the remaining overlap on my side is MIN_NAME_ROOM; happy to rename mine to whatever reads best next to yours.

🤖 Addressed by Claude Code

…g it

On the FreeBSD runner a click's synthetic input can arrive a frame or two late, so after opening
`/a/b/c/d` the row of `/a/b/c/d/e` was not drawn yet when the next click asked for it. The
fixture now steps until each level's chevron is drawn before clicking it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aiongg added a commit to aiongg/lightcraft that referenced this pull request Oct 22, 2026
… their indent step before names are cut (storytold#2298)

docs/parity-checklist.md: header and revision rows from both sides
@aiongg
aiongg merged commit 3dd1b88 into storytold:main Oct 22, 2026
5 checks passed
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.

Sidebar: deep folder trees push names out of a narrow panel — let the indent step follow the panel width

4 participants