Skip to content

LR-IMP-LOCAL: browsing a Local folder keeps or picks the active photo (fixes #1447) - #1820

Merged
echelon merged 1 commit into
storytold:mainfrom
bitshiftza:photo-grid-preview
Oct 15, 2026
Merged

echelon merged 1 commit into
storytold:mainfrom
bitshiftza:photo-grid-preview

Conversation

@bitshiftza

Copy link
Copy Markdown
Contributor

Fixes #1447

What was wrong

Photo Grid is a grid-only view by design, as Lightroom's Photo Grid is: there is no large preview above the grid in any source, so that part of the report is expected. The bug behind it was the active photo. Choosing an album or another source already keeps the active photo if the new view shows it, and otherwise makes the first photo active. Showing a Local folder didn't do this. library.browse switched the source without touching the selection, so the photo from the previous view stayed active even though the folder doesn't hold it. As a result:

  • Photo Grid marked no photo;
  • the histogram and photo info described a photo that isn't in the folder;
  • switching to Detail opened on that other photo, not on one in the folder.

What changed

  • Session::keep_active_in_view (engine) holds the rule every source follows. The active photo stays if the view shows it. Otherwise the view's first photo becomes the active and only selected photo, or nothing is selected when the view is empty. library.source now uses it instead of its own copy.
  • library.browse applies the rule in the engine command and in the UI's background folder read: once when the view switches to the folder, and again as each batch of the folder's photos arrives, but only while that folder is still on screen. A photo you click in the folder while it loads stays selected.

This matches Lightroom: opening a folder or collection shows one of its photos as the active one, never a photo from another source.

Tests

  • tests_browse_active::browsing_a_local_folder_makes_its_first_photo_active (UI, headless): with a library photo active, browsing a folder of PNGs makes the folder's first photo active and selected, and Detail opens on it. Browsing back to the folder keeps a folder photo that was active. Fails before the fix.
  • tests_browse_active::choosing_an_album_keeps_or_picks_the_active_photo: the reference rule for albums.
  • tests_import::browsing_a_folder_keeps_or_picks_the_active_photo (engine library.browse). Fails before the fix.

Before / after: a Local folder in Photo Grid and Detail (synthetic images)

…storytold#1447)

library.browse (engine and the UI's background read) switched the source to the
folder without touching the selection, so the previous view's photo stayed
active: Photo Grid marked nothing, and Detail, the histogram and the info
showed a photo the folder doesn't hold. Browsing now follows library.source's
rule through a shared Session::keep_active_in_view: the active photo stays when
the folder shows it, else the folder's first photo becomes active (also as the
background read's batches arrive).
@echelon

echelon commented Oct 15, 2026

Copy link
Copy Markdown
Member

Thank you @bitshiftza! This landed on main in integration batch 36 (#1843).

If you haven't already, please join our Discord: https://discord.gg/artcraft. We'd love to have you there.

pehonnet pushed a commit to pehonnet/lightcraft that referenced this pull request Oct 15, 2026
Batches 36's doc conflicts kept main's side of rows both sides had touched; for some, main had not changed the row,
so the PR's update was lost. Restored: LR-VIEW-FILMSTRIP (storytold#1482), KEYC-COMPARE (storytold#1491 + storytold#1555), LR-IMP-LOCAL
(storytold#1547 + storytold#1820), LR-LIB-STACK (storytold#1556), gaps 28 (storytold#1555), 2 (storytold#1029) and 23 (storytold#1038), ROADMAP UI/UX (storytold#1038). The
raw-parity by-maker and by-use tables are re-measured with coverage.py (545 verified, ~94% / ~85%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Photo Grid: selecting a Library folder/album fills the grid but shows no large preview of the active photo

2 participants