From a5b9ca1d4715abb8e517b63075ae70a826a49215 Mon Sep 17 00:00:00 2001 From: Bruno-Alumn <171815746+Bruno-Alumn@users.noreply.github.com> Date: Sat, 31 Oct 2026 03:57:16 +0100 Subject: [PATCH 1/5] =?UTF-8?q?LR-FILT-RATING:=20=3D=20or=20=E2=89=A4=20no?= =?UTF-8?q?=20stars=20shows=20the=20unrated=20photos=20instead=20of=20ever?= =?UTF-8?q?y=20photo=20(#3417)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/catalog/src/query.rs | 10 ++++++++-- crates/engine/src/tests.rs | 28 ++++++++++++++++++++++++++++ crates/engine/src/view.rs | 6 ++++-- docs/parity-checklist.md | 5 +++-- docs/whats-new.md | 7 +++++++ 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/crates/catalog/src/query.rs b/crates/catalog/src/query.rs index 94cfa176406..6683a6d2c68 100644 --- a/crates/catalog/src/query.rs +++ b/crates/catalog/src/query.rs @@ -263,9 +263,15 @@ impl Filter { self.describe_in(Some(cat)) } + /// Whether the rating rule narrows the view. Only "at least no stars" lets every photo through: + /// "exactly" or "at most" no stars shows the unrated photos, as in Lightroom's filter bar (#3417). + pub fn rating_filters(&self) -> bool { + self.rating > 0 || self.rating_op != RatingOp::AtLeast + } + fn describe_in(&self, cat: Option<&crate::Catalog>) -> String { let mut v: Vec = Vec::new(); - if self.rating > 0 { + if self.rating_filters() { let op = match self.rating_op { RatingOp::AtLeast => "≥", RatingOp::Exactly => "=", @@ -367,7 +373,7 @@ impl Filter { } } } - if self.rating > 0 { + if self.rating_filters() { let ok = match self.rating_op { RatingOp::AtLeast => p.rating >= self.rating, RatingOp::Exactly => p.rating == self.rating, diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index ae03859d21f..676e6092f4c 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -1377,6 +1377,34 @@ fn find_similar_of_a_flat_photo_shows_an_empty_view_and_counts_zero() { assert_eq!(s.visible_cloned().len(), s.catalog.len()); } +/// Issue #3417: "exactly" or "at most" no stars in the filter bar shows the unrated photos, as in +/// Lightroom, instead of switching the rating rule off; "at least" no stars still shows all. +#[test] +fn rating_exactly_or_at_most_zero_shows_the_unrated_photos() { + let mut s = demo(); + let ids: Vec = s.catalog.photos().map(|p| p.id.0).collect(); + assert!(ids.len() >= 3); + s.execute("photo.rate", &json!({"rating": 0, "ids": ids})).unwrap(); + s.execute("photo.rate", &json!({"rating": 2, "ids": [ids[0]]})).unwrap(); + s.execute("photo.rate", &json!({"rating": 5, "ids": [ids[1]]})).unwrap(); + let unrated = ids.len() - 2; + for op in ["exactly", "atMost"] { + s.execute("library.filter", &json!({"rating": 0, "ratingOp": op})).unwrap(); + let shown = s.visible_cloned(); + assert_eq!(shown.len(), unrated, "{op} 0"); + assert!(shown.iter().all(|id| s.catalog.photo(*id).unwrap().rating == 0), "{op} 0 shows only unrated photos"); + assert_eq!(s.catalog.count(&s.filter), unrated); + let chips = crate::filter_chips(&s.filter, &s.catalog); + assert_eq!(chips.iter().map(|c| c.label.as_str()).collect::>(), ["Unrated"], "{op}"); + s.execute("library.filter", &chips[0].clear).unwrap(); + assert_eq!(s.filter, Default::default(), "the chip clears the rule and its operator"); + assert_eq!(s.visible_cloned().len(), ids.len()); + } + s.execute("library.filter", &json!({"rating": 0, "ratingOp": "atLeast"})).unwrap(); + assert_eq!(s.visible_cloned().len(), ids.len(), "at least no stars is every photo"); + assert!(crate::filter_chips(&s.filter, &s.catalog).is_empty()); +} + #[test] fn find_similar_values_stay_within_zero_and_one() { let mut s = demo(); diff --git a/crates/engine/src/view.rs b/crates/engine/src/view.rs index dbfb0fade6f..0773b6a4455 100644 --- a/crates/engine/src/view.rs +++ b/crates/engine/src/view.rs @@ -150,13 +150,15 @@ pub fn filter_chips(f: &Filter, cat: &Catalog) -> Vec { if !f.text.trim().is_empty() { add(format!("Search: “{}”", f.text.trim()), json!({"text": ""})); } - if f.rating > 0 { + if f.rating_filters() { let op = match f.rating_op { RatingOp::AtLeast => "≥", RatingOp::Exactly => "=", RatingOp::AtMost => "≤", }; - add(format!("Rating {op} {}★", f.rating), json!({"rating": 0})); + // "= 0" and "≤ 0" are the unrated photos; clearing the chip takes the operator back too + let label = if f.rating == 0 { "Unrated".to_string() } else { format!("Rating {op} {}★", f.rating) }; + add(label, json!({"rating": 0, "ratingOp": "atLeast"})); } if let Some(fl) = f.flag { add(format!("Flag: {}", format!("{fl:?}").to_lowercase()), json!({"flag": Null})); diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 08dab300b2a..6b0033f7ee9 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -1,6 +1,6 @@ # Lightroom parity checklist -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-27 · **Change:** minor (LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-27 · **Change:** minor (LR-FILT-RATING: = or ≤ no stars shows the unrated photos, #3417; LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what we have and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good @@ -148,7 +148,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). |---|---|---|---|---|---| | LR-FILT-SEARCH-META | Text search | P0 | ✅ | `cmd:library.filter` (`text`), `crates/ui-egui/src/panels/topbar.rs`, `crates/catalog/src/query.rs` | fielded tokens (`rating:3`, `iso:>800`, `rating:>=3` / `iso:<=400`, `camera:…`); plain words also match the people named on faces; double quotes keep several words in one token (`person:"Jane Doe"`, `"jane doe"`, issue #1449); no suggestions dropdown | | LR-FILT-SEARCH-AI | Natural-language search | P2 | ⬜ | | | -| LR-FILT-RATING | Rating filter | P0 | ✅ | `cmd:library.filter` (`rating`, `ratingOp`), `crates/ui-egui/src/panels/filterbar.rs` | ≥ / = / ≤ stars in the filter bar (`cmd:view.filterBar`) | +| LR-FILT-RATING | Rating filter | P0 | ✅ | `cmd:library.filter` (`rating`, `ratingOp`), `crates/ui-egui/src/panels/filterbar.rs` | ≥ / = / ≤ stars in the filter bar (`cmd:view.filterBar`); = or ≤ no stars shows the unrated photos, as in Lightroom (issue #3417, `rating_exactly_or_at_most_zero_shows_the_unrated_photos`) | | LR-FILT-FLAG | Flag filter | P0 | ✅ | `cmd:library.filter` (`flag`), `crates/ui-egui/src/panels/filterbar.rs` | picked / rejected / unflagged (one at a time) | | LR-FILT-LABEL | Colour-label filter | P1 | ✅ | `cmd:library.filter` (`label`), `crates/ui-egui/src/panels/filterbar.rs` | one label at a time; no “no label” choice | | LR-FILT-TYPE | Type / edited filter | P1 | ✅ | `cmd:library.filter` (`kind`, `merged`, `edited`), `crates/ui-egui/src/panels/filterbar.rs`, `crates/catalog/src/query.rs` (`merged_kind`) | photos / raw / videos / HDR / panoramas / HDR panoramas (merge results by name), edited / unedited; no depth kind | @@ -799,6 +799,7 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | Date | Change | Summary | |---|---|---| +| 2026-10-31 | patch | LR-FILT-RATING: = or ≤ no stars in the filter bar shows the unrated photos instead of every photo (#3417); status unchanged | | 2026-10-25 | patch | LR-BEHAV-TITLEBAR: the top bar's title-bar gestures come from craft-window's `title_bar`: a double-click follows the system setting, and a press on a button, the search field or a panel floating over the bar never moves the window; status counts unchanged | | 2026-10-24 | minor | KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 (`keyword.nextSet`, `keyword.previousSet`) go to the next / previous keyword set; status counts unchanged (KEYC-METADATA stays 🟡) | | 2026-10-24 | minor | KEYC-METADATA: ⌘K / Ctrl+K (`panel.addKeywords`, Add Keywords) shows the Keywords panel, opens Keywording and puts the cursor in the Add keyword box; status counts unchanged (KEYC-METADATA stays 🟡) | diff --git a/docs/whats-new.md b/docs/whats-new.md index a0213da8287..913fb84cd34 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -1,5 +1,12 @@ # What's new in LightCraft +## 2026-10-31 + +### Filter for unrated photos +- In the filter bar, Rating "= exactly" or "≤ at most" with no stars now shows the photos without a rating, as in + Lightroom. Before, it switched the rating rule off and showed every photo. "≥ at least" with no stars still shows + everything, and the chip above the grid reads "Unrated" (issue #3417). + ## 2026-10-27 ### The Edit menu groups Select Only Active Photo and Paste Settings from Previous with their kin From 84da099a9b3460ffe5143a54f1f517d44e141db7 Mon Sep 17 00:00:00 2001 From: Bruno-Alumn <171815746+Bruno-Alumn@users.noreply.github.com> Date: Sat, 31 Oct 2026 04:42:29 +0100 Subject: [PATCH 2/5] Saving the view as a smart album keeps the rating's stars with its operator --- crates/engine/src/cmd/library/filters.rs | 6 ++++++ crates/engine/src/tests.rs | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/crates/engine/src/cmd/library/filters.rs b/crates/engine/src/cmd/library/filters.rs index f0a3a504f34..a03f32ab7b0 100644 --- a/crates/engine/src/cmd/library/filters.rs +++ b/crates/engine/src/cmd/library/filters.rs @@ -69,6 +69,12 @@ pub(super) fn view_rules(s: &Session) -> lightcraft_catalog::Filter { } } } + // the rating rule is its stars and operator together: "= no stars" (the unrated + // photos) has the default stars, which alone would leave the album's own with "=" + if s.filter.rating_filters() { + patch.insert("rating".into(), cur["rating"].clone()); + patch.insert("ratingOp".into(), cur["ratingOp"].clone()); + } // the view as it is: a rule that no longer checks (its album was deleted) just matches // nothing there, and mustn't cost the filter bar's settings merge_filter(&base, &Value::Object(patch), "").unwrap_or(base) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 676e6092f4c..590a8da9e4a 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -1403,6 +1403,13 @@ fn rating_exactly_or_at_most_zero_shows_the_unrated_photos() { s.execute("library.filter", &json!({"rating": 0, "ratingOp": "atLeast"})).unwrap(); assert_eq!(s.visible_cloned().len(), ids.len(), "at least no stars is every photo"); assert!(crate::filter_chips(&s.filter, &s.catalog).is_empty()); + + // a smart album of rated photos, viewed with "= no stars": the view saves "= 0", not "= 3" + let r = s.execute("album.createSmart", &json!({"name": "Rated", "rules": {"rating": 3}})).unwrap(); + s.execute("library.source", &json!({"kind": "album", "id": r["id"]})).unwrap(); + s.execute("library.filter", &json!({"rating": 0, "ratingOp": "exactly"})).unwrap(); + let saved = s.view_rules(); + assert_eq!((saved.rating, saved.rating_op), (0, lightcraft_catalog::RatingOp::Exactly)); } #[test] From bec3f0bb1ab6979cb457edfce784ef4d89014249 Mon Sep 17 00:00:00 2001 From: Bruno-Alumn <171815746+Bruno-Alumn@users.noreply.github.com> Date: Sun, 8 Nov 2026 01:59:49 +0000 Subject: [PATCH 3/5] =?UTF-8?q?LR-FILT-RATING:=20deleting=20the=20keyword?= =?UTF-8?q?=20of=20a=20filter=20put=20aside=20keeps=20=3D=20or=20=E2=89=A4?= =?UTF-8?q?=20no=20stars?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable Filters can put aside a filter of a keyword and "= no stars" or "≤ no stars". Deleting that keyword dropped the whole filter, as if the rating operator alone filtered nothing. Since #3417 those operators show the unrated photos, so the rule is still put aside and comes back. "≥ no stars" still filters nothing and is dropped. --- crates/engine/src/cmd/keywords.rs | 8 +++--- .../src/cmd/library/tests_enable_filters.rs | 27 ++++++++++++++++--- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/cmd/keywords.rs b/crates/engine/src/cmd/keywords.rs index 0e612227f1f..8bbd0d1b1dd 100644 --- a/crates/engine/src/cmd/keywords.rs +++ b/crates/engine/src/cmd/keywords.rs @@ -39,9 +39,11 @@ fn commit_keywords(s: &mut Session, label: &str, op: lightcraft_catalog::Op, fol && let Some(k) = f.keyword.clone() { f.keyword = follow(&k); - // the keyword was deleted: if that emptied the filter, nothing is left to bring back. The rating - // operator filters nothing without stars, so it alone does not count as something to bring back. - gone_from_put_aside = f.keyword.is_none() && (Filter { rating_op: Default::default(), ..f.clone() }) == Filter::default(); + // the keyword was deleted: if that emptied the filter, nothing is left to bring back. "At least + // no stars" filters nothing, so that operator alone does not count; "exactly" or "at most" no + // stars shows the unrated photos (#3417), so it is still something to bring back. + gone_from_put_aside = + f.keyword.is_none() && !f.rating_filters() && (Filter { rating_op: Default::default(), ..f.clone() }) == Filter::default(); } if gone_from_put_aside { s.shelved_filter = None; diff --git a/crates/engine/src/cmd/library/tests_enable_filters.rs b/crates/engine/src/cmd/library/tests_enable_filters.rs index 1a40a179235..9f75b08d2d2 100644 --- a/crates/engine/src/cmd/library/tests_enable_filters.rs +++ b/crates/engine/src/cmd/library/tests_enable_filters.rs @@ -188,18 +188,37 @@ fn deleting_a_keyword_put_aside_keeps_the_rest_of_the_filter() { } #[test] -fn a_rating_operator_without_stars_does_not_keep_an_emptied_filter_put_aside() { +fn at_least_no_stars_does_not_keep_an_emptied_filter_put_aside() { let mut s = session_with_a_cat(); - // the filter bar's operator picker can be set with no stars chosen; it filters nothing - s.execute("library.filter", &json!({"keyword": "cat", "ratingOp": "exactly"})).unwrap(); + // "at least no stars" lets every photo through: it filters nothing + s.execute("library.filter", &json!({"keyword": "cat", "ratingOp": "atLeast"})).unwrap(); s.execute("library.toggleFilters", &json!({})).unwrap(); assert!(s.filters_off()); s.execute("keyword.delete", &json!({"keyword": "cat"})).unwrap(); - assert!(!s.filters_off(), "only an operator with no stars is left: nothing to bring back"); + assert!(!s.filters_off(), "only an operator that filters nothing is left: nothing to bring back"); let r = s.execute("library.toggleFilters", &json!({})).unwrap(); assert_eq!(r["enabled"], json!(true)); } +#[test] +fn exactly_or_at_most_no_stars_put_aside_comes_back_when_the_keyword_goes() { + for op in ["exactly", "atMost"] { + let mut s = session_with_a_cat(); + // "= no stars" and "≤ no stars" show the unrated photos (#3417), so the rule is worth bringing back + s.execute("library.filter", &json!({"keyword": "cat", "ratingOp": op})).unwrap(); + s.execute("library.toggleFilters", &json!({})).unwrap(); + assert!(s.filters_off()); + s.execute("keyword.delete", &json!({"keyword": "cat"})).unwrap(); + assert!(s.filters_off(), "{op} no stars is still put aside"); + let r = s.execute("library.toggleFilters", &json!({})).unwrap(); + assert_eq!(r["enabled"], json!(true), "{op}"); + assert_eq!(s.filter.keyword, None, "{op}"); + assert_eq!(s.filter.rating, 0, "{op}"); + assert_ne!(s.filter.rating_op, lightcraft_catalog::RatingOp::AtLeast, "{op}"); + assert_eq!(s.visible().len(), 1, "{op}: only the unrated photo shows"); + } +} + #[test] fn a_rating_operator_put_aside_survives_a_keyword_change_that_does_not_touch_it() { let mut s = session_with_a_cat(); From ca610219b93a11ea25bfa9d10984deeae549676a Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Sat, 28 Nov 2026 01:10:38 +0100 Subject: [PATCH 4/5] style: apply CI formatting to saved rating filters --- crates/engine/src/cmd/library/filters.rs | 6 ++---- crates/ui-egui/src/tests/rules_reorder.rs | 9 ++++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/cmd/library/filters.rs b/crates/engine/src/cmd/library/filters.rs index 07e67ee4656..ead44e6ee3e 100644 --- a/crates/engine/src/cmd/library/filters.rs +++ b/crates/engine/src/cmd/library/filters.rs @@ -60,10 +60,8 @@ pub(super) fn view_rules(s: &Session) -> lightcraft_catalog::Filter { Some(base) => { // Exactly or at most zero selects only zero. Keep the album's saved rating // and represent an impossible intersection explicitly instead of widening the view. - let no_match = s.filter.rating == 0 - && s.filter.rating_filters() - && base.rating > 0 - && base.rating_op != lightcraft_catalog::RatingOp::AtMost; + let no_match = + s.filter.rating == 0 && s.filter.rating_filters() && base.rating > 0 && base.rating_op != lightcraft_catalog::RatingOp::AtMost; // overlay the fields the filter bar changed let cur = serde_json::to_value(&s.filter).unwrap_or_default(); let def = serde_json::to_value(Filter::default()).unwrap_or_default(); diff --git a/crates/ui-egui/src/tests/rules_reorder.rs b/crates/ui-egui/src/tests/rules_reorder.rs index 8dcd81ec7ac..7dc98fabe04 100644 --- a/crates/ui-egui/src/tests/rules_reorder.rs +++ b/crates/ui-egui/src/tests/rules_reorder.rs @@ -119,9 +119,12 @@ fn a_saved_no_match_smart_album_keeps_its_filters_until_explicitly_enabled() { let id = h .app .session - .execute("album.createSmart", &json!({"name": "Empty view", "rules": { - "rating": 1, "onlyNone": true, "ruleSet": {"match": "any", "rules": [group_at_limit]} - }})) + .execute( + "album.createSmart", + &json!({"name": "Empty view", "rules": { + "rating": 1, "onlyNone": true, "ruleSet": {"match": "any", "rules": [group_at_limit]} + }}), + ) .unwrap()["id"] .as_u64() .unwrap(); From 9f11801d27aac0d4880db0e510f9fc1df5fcf53f Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Sat, 28 Nov 2026 01:27:00 +0100 Subject: [PATCH 5/5] refactor: separate no-match Smart Album rendering --- crates/ui-egui/src/dialogs.rs | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 1ee85871b22..d3155d1f455 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1042,19 +1042,8 @@ fn smart_rules_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: ); crate::widgets::register(ui, "field:smartName", r.rect); ui.add_space(6.0); - if let Some(mut saved) = no_match_album(app, *id).cloned() { - let allow = ui.checkbox(allow_matching, crate::i18n::tr("Allow saved rules to match photos")); - crate::widgets::register(ui, "field:smartAllowMatching", allow.rect); - let preview = if *allow_matching { - saved.only_none = false; - let n = smart_filter_preview_count(app, &saved); - crate::i18n::tr_format!("{n} photo{} match · updates automatically as photos change", if n == 1 { "" } else { "s" }, n = n) - } else { - crate::i18n::tr("Only 0 photos").to_string() - }; - // Keep one live node across both states: the screen reader gets changed text without moving focus. - let status = ui.push_id("smartRulesMatchStatus", |ui| ui.label(preview)).inner; - ui.ctx().accesskit_node_builder(status.id, |node| node.set_live(egui::accesskit::Live::Polite)); + if let Some(saved) = no_match_album(app, *id).cloned() { + smart_rules_no_match_body(app, ui, allow_matching, saved); return; } // the folder an album made from a folder view carries is not in the editor, but it counts @@ -1070,22 +1059,33 @@ fn smart_rules_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: egui::ScrollArea::vertical().max_height(list_height(ui, 360.0)).auto_shrink([false, true]).show(ui, |ui| { crate::panels::rules_editor::edit(ui, rules, "rules", 0, &[], &env); }); - let n = view.count; ui.add_space(4.0); if view.problems.is_empty() { - ui.label( - egui::RichText::new(crate::i18n::tr_format!( - "{n} photo{} match · updates automatically as photos change", - if n == 1 { "" } else { "s" }, - n = n - )) - .color(t.text_dim), - ); + ui.label(egui::RichText::new(smart_rules_match_text(view.count)).color(t.text_dim)); } else { ui.label(egui::RichText::new(crate::i18n::tr("Fix the marked rules to save this album.")).color(t.caution)); } } +/// The existing rules are read-only while editing a no-match album's matching behavior. +fn smart_rules_no_match_body(app: &mut LightcraftApp, ui: &mut egui::Ui, allow_matching: &mut bool, mut saved: lightcraft_catalog::Filter) { + let allow = ui.checkbox(allow_matching, crate::i18n::tr("Allow saved rules to match photos")); + crate::widgets::register(ui, "field:smartAllowMatching", allow.rect); + let preview = if *allow_matching { + saved.only_none = false; + smart_rules_match_text(smart_filter_preview_count(app, &saved)) + } else { + crate::i18n::tr("Only 0 photos").to_string() + }; + // Keep one live node across both states: the screen reader gets changed text without moving focus. + let status = ui.push_id("smartRulesMatchStatus", |ui| ui.label(preview)).inner; + ui.ctx().accesskit_node_builder(status.id, |node| node.set_live(egui::accesskit::Live::Polite)); +} + +fn smart_rules_match_text(n: usize) -> String { + crate::i18n::tr_format!("{n} photo{} match · updates automatically as photos change", if n == 1 { "" } else { "s" }, n = n) +} + fn smart_filter_preview_count(app: &mut LightcraftApp, rules: &lightcraft_catalog::Filter) -> usize { if rules.only_none { return 0;