From 55673bd1d639d3f091a053cdfa1de018bfa89e1e Mon Sep 17 00:00:00 2001 From: OneSlips Date: Fri, 16 Oct 2026 17:03:00 +1000 Subject: [PATCH 1/8] FIX-KEYWORDS: a keyword list written as one metadata entry is a keyword a line; names drawn on one line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The left panel's ghost text: the user's camera writes its whole keyword list as one dc:subject item, a keyword a line ("Beautiful Bride Bride and Groom…"). It was read as one keyword many lines tall, and its sidebar row painted the lines over the rows around it. keywords::from_file now splits an entry at line breaks (one keyword a line, blanks dropped); a library whose photos already carry such a keyword is repaired when it opens (Session::split_multiline_keywords, journaled, not an undo step); and the sidebar and Keyword List rows draw any name on one line (keywords::one_line). Co-Authored-By: Claude Opus 5.5 (cherry picked from commit 10541d62c3a2960bd787668ee26c5a0cfc6f2886) # Conflicts: # crates/catalog/src/keywords.rs # crates/engine/src/tests_culling.rs --- crates/catalog/src/keywords.rs | 38 +++++++++++++++++++-- crates/engine/src/library.rs | 34 ++++++++++++++++++ crates/engine/src/tests_keyword_list.rs | 14 ++++++++ crates/ui-egui/src/panels/keyword_list.rs | 3 +- crates/ui-egui/src/panels/left.rs | 4 +++ crates/ui-egui/src/tests_keyword_sidebar.rs | 21 ++++++++++++ docs/parity-checklist.md | 3 +- docs/whats-new.md | 7 ++++ 8 files changed, 120 insertions(+), 4 deletions(-) diff --git a/crates/catalog/src/keywords.rs b/crates/catalog/src/keywords.rs index 6b0c97f5a3..492363405f 100644 --- a/crates/catalog/src/keywords.rs +++ b/crates/catalog/src/keywords.rs @@ -46,17 +46,39 @@ pub fn reparent(k: &str, from: &str, to: &str) -> String { /// A file's keywords as a photo carries them: the paths of `lr:hierarchicalSubject`, then the /// names of `dc:subject` that aren't levels of those paths (Lightroom Classic writes each keyword's /// name, its parents' and synonyms flat besides its path). Each once, cleaned. +/// +/// An entry holding several lines is several keywords: some cameras' metadata presets write the +/// whole list as one `dc:subject` item, a keyword a line ("Beautiful Bride Bride and +/// Groom…"). Read as one, it would be a single keyword many lines tall. pub fn from_file(flat: &[String], hierarchical: &[String]) -> Vec { - let mut out: Vec = hierarchical.iter().map(|k| clean(k)).collect(); + let lines = |v: &[String]| -> Vec { v.iter().flat_map(|k| split_lines(k)).collect() }; + let (flat, hierarchical) = (lines(flat), lines(hierarchical)); + let mut out: Vec = hierarchical.iter().map(|k| clean(k)).filter(|k| !k.is_empty()).collect(); // One lowered set of every hierarchical level, not a search of `hierarchical` for each flat // keyword: disjoint lists from sidecars made the old approach quadratic in both (CWE-407), and // `same` allocates two lower-cased strings per comparison. let levels: std::collections::HashSet = hierarchical.iter().flat_map(|h| h.split(SEP).map(|l| l.trim().to_lowercase())).collect(); - out.extend(flat.iter().map(|k| clean(k)).filter(|k| !levels.contains(&k.to_lowercase()))); + out.extend(flat.iter().map(|k| clean(k)).filter(|k| !k.is_empty()).filter(|k| !levels.contains(&k.to_lowercase()))); dedupe(&mut out); out } +/// The keywords of one metadata entry: one a line (any of `\r`, `\n`, the Unicode line and +/// paragraph separators), blank lines dropped. +pub fn split_lines(k: &str) -> Vec { + k.split(['\r', '\n', '\u{2028}', '\u{2029}']).map(str::trim).filter(|l| !l.is_empty()).map(str::to_string).collect() +} + +/// `text` on one line: line breaks become spaces (a name drawn in a row must never spill over +/// the rows around it). +pub fn one_line(text: &str) -> std::borrow::Cow<'_, str> { + if text.contains(['\r', '\n', '\u{2028}', '\u{2029}']) { + std::borrow::Cow::Owned(split_lines(text).join(" ")) + } else { + std::borrow::Cow::Borrowed(text) + } +} + /// The deepest a keyword list file may nest keywords: a file is input, so its nesting is bounded. pub const MAX_LEVELS: usize = 64; @@ -824,6 +846,18 @@ impl Catalog { #[cfg(test)] mod tests { use super::*; + + /// A camera preset's keyword list written as one `dc:subject` item, a keyword a line, is one + /// keyword a line; names stay one line wherever they are drawn. + #[test] + fn a_list_in_one_entry_is_a_keyword_a_line() { + let flat = vec!["Beautiful Bride\r\n Bride and Groom\r\n\r\n Happy Couple".to_string(), "Solo".to_string()]; + assert_eq!(from_file(&flat, &[]), vec!["Beautiful Bride", "Bride and Groom", "Happy Couple", "Solo"]); + assert_eq!(from_file(&["a\nb".to_string()], &["x|a".to_string()]), vec!["x|a", "b"], "a level of a path isn't listed twice"); + assert_eq!(one_line("a\r\n b"), "a b"); + assert!(matches!(one_line("plain"), std::borrow::Cow::Borrowed(_))); + assert!(split_lines("\r\n").is_empty()); + } use crate::{Filter, Photo, PhotoId, Source}; fn lib(kws: &[&[&str]]) -> (Catalog, Vec) { diff --git a/crates/engine/src/library.rs b/crates/engine/src/library.rs index a5071b4b35..c515e516a1 100644 --- a/crates/engine/src/library.rs +++ b/crates/engine/src/library.rs @@ -605,6 +605,12 @@ impl Session { lib.forgot_local = Some(plan); } } + // keywords read whole from a list a line long (before they were split) become one each + if self.split_multiline_keywords() > 0 + && let Err(e) = self.persist() + { + log::error!("library: {e}"); + } // smart previews written by an older camera-look fit are brought up to date in the background #[cfg(not(target_arch = "wasm32"))] if on_disk { @@ -614,6 +620,34 @@ impl Session { Ok(()) } + /// Photos whose keywords hold line breaks (a camera preset's whole keyword list read as one + /// keyword by an earlier version) get one keyword a line, journaled, not an undo step. Returns + /// how many photos changed. + pub fn split_multiline_keywords(&mut self) -> usize { + let fix: Vec<(lightcraft_catalog::PhotoId, lightcraft_catalog::Meta)> = self + .catalog + .photos() + .filter(|p| p.meta.keywords.iter().any(|k| k.contains(['\r', '\n', '\u{2028}', '\u{2029}']))) + .map(|p| { + let mut meta = p.meta.clone(); + meta.keywords = lightcraft_catalog::keywords::from_file(&meta.keywords, &[]); + (p.id, meta) + }) + .collect(); + let n = fix.len(); + for (id, meta) in fix { + let op = lightcraft_catalog::Op::SetMeta { id, meta: Box::new(meta) }; + match self.catalog.apply(op.clone()) { + Ok(_) => self.pending_log.push(op), + Err(e) => log::warn!("split keywords: {e}"), + } + } + if n > 0 { + log::info!("split the line-separated keywords of {n} photo(s) into one keyword a line"); + } + n + } + /// Write pending ops to the log (fsynced), compact when due, and save changed presets. /// Called after every top-level command; cheap when nothing changed. Fails (with /// [`EngineError::NotSaved`]) only when the queued ops couldn't be written; they stay queued. diff --git a/crates/engine/src/tests_keyword_list.rs b/crates/engine/src/tests_keyword_list.rs index b98b45de8d..d7ff5fdfa9 100644 --- a/crates/engine/src/tests_keyword_list.rs +++ b/crates/engine/src/tests_keyword_list.rs @@ -339,3 +339,17 @@ fn importing_keywords_reads_a_list() { assert!(s.execute("keyword.import", &json!({})).is_err(), "a path or text"); let _ = std::fs::remove_dir_all(&dir); } + +/// A library whose photos got a whole keyword list as one keyword (line breaks inside) is +/// repaired when it opens: one keyword a line, journaled. +#[test] +fn line_separated_keywords_are_split_when_the_library_opens() { + let mut s = Session::with_demo(); + let id = s.visible_cloned()[0]; + let mut meta = s.catalog.photo(id).unwrap().meta.clone(); + meta.keywords = vec!["Bride\r\n Groom\r\n Happy Couple".into()]; + s.catalog.apply(lightcraft_catalog::Op::SetMeta { id, meta: Box::new(meta) }).unwrap(); + assert_eq!(s.split_multiline_keywords(), 1); + assert_eq!(s.catalog.photo(id).unwrap().meta.keywords, vec!["Bride", "Groom", "Happy Couple"]); + assert_eq!(s.split_multiline_keywords(), 0, "nothing left to split"); +} diff --git a/crates/ui-egui/src/panels/keyword_list.rs b/crates/ui-egui/src/panels/keyword_list.rs index 43190002ab..3fc7a25dd3 100644 --- a/crates/ui-egui/src/panels/keyword_list.rs +++ b/crates/ui-egui/src/panels/keyword_list.rs @@ -271,7 +271,8 @@ fn row(app: &mut LightcraftApp, ui: &mut egui::Ui, r: &Row, selection: &[PhotoId let room = (arrow.left() - 4.0 - (x + 34.0)).max(0.0); let font = t.font(13.0); let measure = |s: &str| ui.painter().layout_no_wrap(s.to_string(), font.clone(), t.text_label).size().x; - let name = if measure(&r.name) <= room { r.name.clone() } else { crate::widgets::elide_head(&r.name, room, measure) }; + let flat = lightcraft_catalog::keywords::one_line(&r.name); + let name = if measure(&flat) <= room { flat.to_string() } else { crate::widgets::elide_head(&flat, room, measure) }; let label = ui.painter().text(pos2(x + 34.0, cy), Align2::LEFT_CENTER, name, font.clone(), if picked { t.text } else { t.text_label }); // where new keywords go (Put New Keywords Inside This Keyword): a dot after the name if app.session.catalog.default_keyword_parent().as_deref().is_some_and(|k| same(k, &r.path)) { diff --git a/crates/ui-egui/src/panels/left.rs b/crates/ui-egui/src/panels/left.rs index 2c7d2642c9..446edf6117 100644 --- a/crates/ui-egui/src/panels/left.rs +++ b/crates/ui-egui/src/panels/left.rs @@ -132,6 +132,10 @@ fn row_sensed( mark: Option, ) -> egui::Response { let label = if matches!(id, "all" | "recentlyAdded" | "picks" | "missing" | "recentlyDeleted") { crate::i18n::tr(label) } else { label }; + // a name is drawn on one line: one holding line breaks (a whole keyword list read as one + // keyword) would spill over the rows around it + let one_line = lightcraft_catalog::keywords::one_line(label); + let label: &str = &one_line; let t = Tokens::get(ui.ctx()); let indent = drawn_indent(ui, indent); let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), ROW_HEIGHT), sense); diff --git a/crates/ui-egui/src/tests_keyword_sidebar.rs b/crates/ui-egui/src/tests_keyword_sidebar.rs index 95c81ff0d9..bcce5dd681 100644 --- a/crates/ui-egui/src/tests_keyword_sidebar.rs +++ b/crates/ui-egui/src/tests_keyword_sidebar.rs @@ -85,3 +85,24 @@ fn probe_keyword_sidebar_cost() { } eprintln!("frame after a rating: {:?}", t.elapsed() / 10); } + +/// A keyword holding line breaks (a camera preset's whole keyword list read as one keyword by +/// 0.8.x: "Beautiful Bride\r\n Bride and Groom\r\n …") was drawn many lines tall over the rows +/// around it: the ghost text in the Keywords section. A row's name is drawn on one line. +#[test] +fn a_keyword_with_line_breaks_is_drawn_on_one_line() { + let mut s = Session::new(); + let list: Vec = (0..20).map(|i| format!("Wedding Keyword {i:02}")).collect(); + let mut p = + Photo::new(PhotoId(1), Source::File { path: "/lightcraft-kw-test/IMG_1.jpg".into() }, "IMG_1.jpg", "JPEG", 60, 40, "2026-01-01T00:00:00"); + p.meta.keywords = vec![list.join("\r\n "), "Solo".into()]; + s.catalog.apply(Op::AddPhoto { photo: Box::new(p) }).unwrap(); + let app = LightcraftApp::new(s, Services { png: None, ..Default::default() }); + let mut h = Headless::new(app, [1400.0, 900.0], 1.0); + let r = h.request("ui.set", json!({"view": "photoGrid", "leftPanel": true}), T); + assert_eq!(r["ok"], true, "{r}"); + h.settle(SETTLE); + let solo = h.app.widgets.iter().find(|(w, _)| w == "label:keyword:Solo").map(|(_, r)| *r).expect("the Solo row"); + let long = h.app.widgets.iter().find(|(w, _)| w.starts_with("label:keyword:Wedding Keyword 00")).map(|(_, r)| *r).expect("the long row"); + assert!(long.height() <= solo.height() + 0.5, "one line, as tall as any name: {long:?} vs {solo:?}"); +} diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index d059494cef..4f48e1d3f6 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-24 · **Change:** minor (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-25 · **Change:** minor (LRC-LIB-KEYWORDS: a keyword list written as one metadata entry, a keyword a line, is read as one keyword a line; 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 @@ -799,6 +799,7 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | Date | Change | Summary | |---|---|---| +| 2026-10-25 | patch | LRC-LIB-KEYWORDS: a file whose keyword list is one `dc:subject` (or `lr:hierarchicalSubject`) entry with a keyword a line is read as one keyword a line; a library holding such a keyword is repaired when it opens (journaled, not an undo step); sidebar and Keyword List rows draw a name on one line; status unchanged | | 2026-10-24 | patch | LR-LIB-RATING, LR-LIB-DELETE: a slider drag still open when a rating, flag or label takes the photo out of the view, or when the photo is deleted, ends as its own undo step before the selection moves on, as moving to the next photo does; LR-BEHAV-LOCALIZE lists all 18 languages; status unchanged | | 2026-10-24 | patch | Integration batch 43: Integrated main 98702b5c, preserving the new fail-closed GPS metadata check for Original export. Watermark geometry/orientation and HDR JPEG size-limit fixes remain in their shared helpers; no feature-count changes. | | 2026-10-23 | patch | Export integration: Integrated main 5ca49b3e, retaining Width & Height resizing, export format/bit-depth validation and batch panic cancellation alongside the existing watermark and HDR JPEG size-limit fixes. No feature-count changes. | diff --git a/docs/whats-new.md b/docs/whats-new.md index c6c2592003..1a378aeea5 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -1,5 +1,12 @@ # What's new in LightCraft +## 2026-10-25 + +### Keywords +- **No more ghost text in the Keywords list.** Some cameras write their whole keyword list as one metadata entry, + a keyword a line; LightCraft now reads it as one keyword a line, and repairs libraries that already hold such a + keyword when they open. A name with a line break in it is drawn on one line in the sidebar and the Keyword List. + ## 2026-10-24 ### Relative-date filters and smart albums follow the clock From 4069964d139dc3fbbfef00656bd457ad494b2e51 Mon Sep 17 00:00:00 2001 From: OneSlips Date: Wed, 28 Oct 2026 03:33:40 +1000 Subject: [PATCH 2/8] FIX-KEYWORDS: keyword paths are read out and hovered on one line (CodeRabbit, #2922) Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/keyword_list.rs | 29 +++++++++++++++++++--- crates/ui-egui/src/panels/left/keywords.rs | 22 +++++++++++++++- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/panels/keyword_list.rs b/crates/ui-egui/src/panels/keyword_list.rs index 2aa1c47fea..a16031b86f 100644 --- a/crates/ui-egui/src/panels/keyword_list.rs +++ b/crates/ui-egui/src/panels/keyword_list.rs @@ -164,12 +164,24 @@ fn drop_keyword(app: &mut LightcraftApp, ctx: &egui::Context, keyword: &str, par } } +/// A keyword's path as it is read out: on one line, as its name is painted. +fn spoken_path(path: &str) -> String { + lightcraft_catalog::keywords::one_line(path).into_owned() +} + +/// A keyword's path as its row's hover text shows it: on one line, levels joined by ›. +fn hover_path(path: &str) -> String { + spoken_path(path).replace('|', " › ") +} + /// One keyword's row: the triangle, the tick box, the name, the count, and on hover the arrow. /// `can_fold`: the triangle opens and closes the level (not while a filter opens it). fn row(app: &mut LightcraftApp, ui: &mut egui::Ui, r: &Row, selection: &[PhotoId], ticks: &Ticks, can_fold: bool) { let t = Tokens::get(ui.ctx()); let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), ROW_H), Sense::click_and_drag()); - crate::widgets::announce(&resp, r.path.clone()); + // what is read out and hovered shows the path on one line, as the name is painted + let visible_path = spoken_path(&r.path); + crate::widgets::announce(&resp, visible_path.clone()); register(ui, format!("keywordRow:{}", r.path), rect); if resp.drag_started() { app.ui.dragging_keyword = Some(r.path.clone()); @@ -211,7 +223,7 @@ fn row(app: &mut LightcraftApp, ui: &mut egui::Ui, r: &Row, selection: &[PhotoId // (it senses drags too, so a press there that moves doesn't pick the keyword up) let sense = if on { Sense::click_and_drag() } else { Sense::hover() }; let tb = ui.interact(boxr.expand(3.0), egui::Id::unique(("keyword-list-tick", r.path.to_lowercase())), sense); - crate::widgets::announce(&tb, format!("{} {}", crate::i18n::tr("Keyword"), r.path)); + crate::widgets::announce(&tb, format!("{} {}", crate::i18n::tr("Keyword"), visible_path)); register(ui, format!("keywordCheck:{}", r.path), boxr); let edge = if on { t.text_label } else { t.text_dim.gamma_multiply(0.5) }; match state { @@ -283,7 +295,7 @@ fn row(app: &mut LightcraftApp, ui: &mut egui::Ui, r: &Row, selection: &[PhotoId ui.painter().circle_filled(dot.center(), 3.0, t.accent); register(ui, format!("keywordDefault:{}", r.path), dot); } - let resp = resp.on_hover_text(r.path.replace('|', " › ")); + let resp = resp.on_hover_text(hover_path(&r.path)); if resp.clicked() { app.ui.keyword_list_selected = Some(r.path.clone()); } @@ -612,6 +624,17 @@ mod tests { use super::*; + /// A path holding line breaks (CR, LF, U+2028, U+2029) is read out and hovered on one line, as its + /// name is painted (CodeRabbit on #2922). + #[test] + fn a_keyword_path_with_line_breaks_is_read_and_hovered_on_one_line() { + let path = "Wedding|Bride\r\nGroom\u{2028}Guests\u{2029}Cake"; + let breaks = |s: &str| s.contains(['\r', '\n', '\u{2028}', '\u{2029}']); + assert!(!breaks(&spoken_path(path)), "{:?}", spoken_path(path)); + assert!(!breaks(&hover_path(path)), "{:?}", hover_path(path)); + assert!(hover_path(path).starts_with("Wedding › Bride"), "{:?}", hover_path(path)); + } + fn library(keywords: &[&[&str]]) -> (Catalog, Vec) { let mut c = Catalog::new(); let mut ids = Vec::new(); diff --git a/crates/ui-egui/src/panels/left/keywords.rs b/crates/ui-egui/src/panels/left/keywords.rs index 81997f2e2a..39bf24f9ba 100644 --- a/crates/ui-egui/src/panels/left/keywords.rs +++ b/crates/ui-egui/src/panels/left/keywords.rs @@ -27,7 +27,7 @@ fn keyword_row(app: &mut LightcraftApp, ui: &mut egui::Ui, n: &KeywordNode, id: if let Some(k) = open_id { tree_toggle(ui, &resp, indent, k, open, format!("keywordToggle:{}", n.path)); } - let resp = resp.on_hover_text(if n.children.is_empty() { n.path.clone() } else { format!("{} (includes the keywords below it)", n.path) }); + let resp = resp.on_hover_text(keyword_tip(&n.path, !n.children.is_empty())); if resp.clicked() { let v = if sel { serde_json::Value::Null } else { json!(n.path) }; browse_all_photos(app, !sel); @@ -53,3 +53,23 @@ fn keyword_row(app: &mut LightcraftApp, ui: &mut egui::Ui, n: &KeywordNode, id: } }); } + +/// A keyword row's hover text, on one line like the row's name (a path holding line breaks must not +/// spill into a tall tooltip). +fn keyword_tip(path: &str, has_children: bool) -> String { + let path = lightcraft_catalog::keywords::one_line(path); + if has_children { format!("{path} (includes the keywords below it)") } else { path.into_owned() } +} + +#[cfg(test)] +mod tests { + /// A sidebar keyword's hover text is on one line, as its name is painted (CodeRabbit on #2922). + #[test] + fn a_keyword_path_with_line_breaks_is_hovered_on_one_line() { + let path = "Wedding|Bride\r\nGroom\u{2028}Guests\u{2029}Cake"; + for children in [false, true] { + let tip = super::keyword_tip(path, children); + assert!(!tip.contains(['\r', '\n', '\u{2028}', '\u{2029}']), "{tip:?}"); + } + } +} From af0cdaf2cd486e6f8919a071b84b074260807458 Mon Sep 17 00:00:00 2001 From: OneSlips Date: Wed, 28 Oct 2026 06:20:45 +1000 Subject: [PATCH 3/8] FIX-KEYWORDS: the drag label, Inside tooltip, drop toast, menu label and skipped rows use one-line names Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/keyword_list.rs | 29 ++++++++++++++++------- crates/ui-egui/src/panels/left/rows.rs | 3 ++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/crates/ui-egui/src/panels/keyword_list.rs b/crates/ui-egui/src/panels/keyword_list.rs index a16031b86f..9b46acc66e 100644 --- a/crates/ui-egui/src/panels/keyword_list.rs +++ b/crates/ui-egui/src/panels/keyword_list.rs @@ -129,7 +129,7 @@ pub fn drag_feedback(app: &mut LightcraftApp, ctx: &egui::Context) { let Some(at) = at else { return }; let t = Tokens::get(ctx); ctx.set_cursor_icon(egui::CursorIcon::Grabbing); - let name = keyword.rsplit('|').next().unwrap_or(&keyword).to_string(); + let name = drag_leaf(&keyword); egui::Area::new(egui::Id::unique("drag-keyword")).order(egui::Order::Tooltip).interactable(false).fixed_pos(at + vec2(14.0, 10.0)).show( ctx, |ui| { @@ -164,6 +164,11 @@ fn drop_keyword(app: &mut LightcraftApp, ctx: &egui::Context, keyword: &str, par } } +/// The name a dragged keyword's label shows: its last level, on one line. +fn drag_leaf(keyword: &str) -> String { + spoken_path(keyword.rsplit('|').next().unwrap_or(keyword)) +} + /// A keyword's path as it is read out: on one line, as its name is painted. fn spoken_path(path: &str) -> String { lightcraft_catalog::keywords::one_line(path).into_owned() @@ -310,7 +315,7 @@ const INSIDE_NAMED: usize = 4; /// "Inside: Rome, Venice": the applied keywords inside a keyword, the first few by name. fn inside_said(inside: &[String]) -> Option { - let named = inside.iter().take(INSIDE_NAMED).map(String::as_str).collect::>().join(", "); + let named = inside.iter().take(INSIDE_NAMED).map(|name| spoken_path(name)).collect::>().join(", "); let more = inside.len().saturating_sub(INSIDE_NAMED); let names = if more > 0 { format!("{named} {}", crate::i18n::tr_format!("+{n} more", n = more)) } else { named }; (!inside.is_empty()).then(|| crate::i18n::tr_format!("Inside: {names}", names = names)) @@ -349,12 +354,7 @@ fn drop_target(app: &mut LightcraftApp, ui: &mut egui::Ui, rect: Rect, path: &st match app.run("photo.setMeta", json!({"ids": ids, "addKeywords": [path]})) { Ok(_) => app.toast( ui.ctx(), - crate::i18n::tr_format!( - "Added “{keyword}” to {n} photo{}", - if n == 1 { "" } else { "s" }, - keyword = path.replace('|', " › "), - n = n - ), + crate::i18n::tr_format!("Added “{keyword}” to {n} photo{}", if n == 1 { "" } else { "s" }, keyword = hover_path(path), n = n), ), Err(e) => app.toast(ui.ctx(), e), } @@ -364,7 +364,7 @@ fn drop_target(app: &mut LightcraftApp, ui: &mut egui::Ui, rect: Rect, path: &st /// A keyword's context menu. fn menu(app: &mut LightcraftApp, ui: &mut egui::Ui, path: &str, selection: &[PhotoId]) { - let name = path.replace('|', " › "); + let name = hover_path(path); let item = |ui: &mut egui::Ui, id: &str, label: &str, enabled: bool| { let r = ui.add_enabled(enabled, egui::Button::new(label)); register(ui, format!("keywordMenu:{id}"), r.rect); @@ -635,6 +635,17 @@ mod tests { assert!(hover_path(path).starts_with("Wedding › Bride"), "{:?}", hover_path(path)); } + /// The dragged keyword's label and the tick box's "Inside: …" name keywords on one line too (CodeRabbit on + /// #2922). + #[test] + fn a_dragged_keyword_and_the_keywords_inside_one_are_named_on_one_line() { + let breaks = |s: &str| s.contains(['\r', '\n', '\u{2028}', '\u{2029}']); + assert_eq!(drag_leaf("Wedding|Bride\nGroom"), "Bride Groom"); + let inside = inside_said(&["Rome\r\nCentre".to_string(), "Venice\u{2029}Lido".to_string()]).unwrap(); + assert!(!breaks(&inside), "{inside:?}"); + assert!(inside.contains("Rome Centre") && inside.contains("Venice Lido"), "{inside:?}"); + } + fn library(keywords: &[&[&str]]) -> (Catalog, Vec) { let mut c = Catalog::new(); let mut ids = Vec::new(); diff --git a/crates/ui-egui/src/panels/left/rows.rs b/crates/ui-egui/src/panels/left/rows.rs index 5eac45b2a0..f2dbe60e0a 100644 --- a/crates/ui-egui/src/panels/left/rows.rs +++ b/crates/ui-egui/src/panels/left/rows.rs @@ -202,7 +202,8 @@ pub(super) fn out_of_sight(app: &LightcraftApp, ui: &mut egui::Ui, id: &str, lab let indent = drawn_indent(ui, indent); let t = Tokens::get(ui.ctx()); let painter = ui.painter(); - let name_w = painter.layout_no_wrap(label.to_string(), t.font(13.5), t.text_label).size().x; + // measured as the row paints it: on one line + let name_w = painter.layout_no_wrap(lightcraft_catalog::keywords::one_line(label).into_owned(), t.font(13.5), t.text_label).size().x; let count_w = count.filter(|_| app.ui.show_counts).map(|n| painter.layout_no_wrap(n.to_string(), t.font(12.5), t.text_dim).size().x); note_width(ui, row_need(indent, name_w, if mark { MARK_W } else { 0.0 }, count_w)); true From da694eda9ba4f94b7b54d99e6b698e3feca8c9b9 Mon Sep 17 00:00:00 2001 From: OneSlips Date: Sun, 1 Nov 2026 03:44:07 +1000 Subject: [PATCH 4/8] FIX-KEYWORDS: the Create Keyword Tag dialog names its parent keyword on one line (CodeRabbit, #2922) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Put inside" tick box showed the raw parent path with only | turned into ›, so a parent holding a line break (CR, LF, U+2028, U+2029) drew the label on several lines. It now uses the Keyword List's hover text (one line, levels joined by ›); the stored parent is unchanged. Test: the_put_inside_box_names_its_parent_on_one_line. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/dialogs.rs | 2 +- crates/ui-egui/src/panels/keyword_list.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 07f050aa7a..21bded0593 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1712,7 +1712,7 @@ fn keyword_tag_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, conf ui.add_space(6.0); if editing.is_none() { if let Some(p) = parent { - let r = ui.checkbox(inside, crate::i18n::tr_format!("Put inside “{parent}”", parent = p.replace('|', " › "))); + let r = ui.checkbox(inside, crate::panels::keyword_list::put_inside_label(p)); crate::widgets::register(ui, "check:keywordInside", r.rect); } let n = app.session.selection.ids.len(); diff --git a/crates/ui-egui/src/panels/keyword_list.rs b/crates/ui-egui/src/panels/keyword_list.rs index 7ffc856b4a..8e1331fc9c 100644 --- a/crates/ui-egui/src/panels/keyword_list.rs +++ b/crates/ui-egui/src/panels/keyword_list.rs @@ -179,6 +179,11 @@ fn hover_path(path: &str) -> String { spoken_path(path).replace('|', " › ") } +/// The Create Keyword Tag dialog's "Put inside …" tick box: the parent keyword on one line, levels joined by ›. +pub(crate) fn put_inside_label(parent: &str) -> String { + crate::i18n::tr_format!("Put inside “{parent}”", parent = hover_path(parent)) +} + /// One keyword's row: the triangle, the tick box, the name, the count, and on hover the arrow. /// `can_fold`: the triangle opens and closes the level (not while a filter opens it). fn row(app: &mut LightcraftApp, ui: &mut egui::Ui, r: &Row, selection: &[PhotoId], ticks: &Ticks, can_fold: bool) { @@ -664,6 +669,14 @@ mod tests { assert!(inside.contains("Rome Centre") && inside.contains("Venice Lido"), "{inside:?}"); } + /// The Create Keyword Tag dialog names a parent keyword holding line breaks on one line (CodeRabbit on #2922). + #[test] + fn the_put_inside_box_names_its_parent_on_one_line() { + let label = put_inside_label("Wedding|Bride\r\nGroom\u{2028}Guests"); + assert!(!label.contains(['\r', '\n', '\u{2028}', '\u{2029}']), "{label:?}"); + assert!(label.contains("Wedding › Bride Groom"), "{label:?}"); + } + fn library(keywords: &[&[&str]]) -> (Catalog, Vec) { let mut c = Catalog::new(); let mut ids = Vec::new(); From afc83175e67f06748e3de4da4586f9e7796e73e8 Mon Sep 17 00:00:00 2001 From: OneSlips Date: Sun, 1 Nov 2026 05:36:15 +1000 Subject: [PATCH 5/8] FIX-KEYWORDS: the keyword repair keeps a split keyword's export options and writes the repaired sidecars (CodeRabbit, #2922) - A listed keyword with line breaks hands its options to the names it splits into, and its own record goes; a name listed already keeps its options but is left out of export when either was, so a keyword the user kept out of exports stays out (test a_split_keyword_keeps_its_export_options). - The repair runs when a library opens, outside a command, so with automatic XMP writing on it now writes the repaired photos' sidecars itself, as a command does (test the_keyword_repair_writes_the_sidecar_with_auto_write_on). Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/library.rs | 38 +++++++++++++++++++++++-- crates/engine/src/tests/keyword_list.rs | 24 ++++++++++++++++ crates/engine/src/tests/xmp.rs | 19 +++++++++++++ 3 files changed, 78 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/library.rs b/crates/engine/src/library.rs index df2e4218fb..e591511d8b 100644 --- a/crates/engine/src/library.rs +++ b/crates/engine/src/library.rs @@ -653,7 +653,8 @@ impl Session { } } // keywords read whole from a list a line long (before they were split) become one each - if self.split_multiline_keywords() > 0 + let journaled = self.pending_log.len(); + if (self.split_multiline_keywords() > 0 || self.pending_log.len() > journaled) && let Err(e) = self.persist() { log::error!("library: {e}"); @@ -669,12 +670,39 @@ impl Session { /// Photos whose keywords hold line breaks (a camera preset's whole keyword list read as one /// keyword by an earlier version) get one keyword a line, journaled, not an undo step. Returns - /// how many photos changed. + /// how many photos changed. A listed keyword with line breaks hands its options to the names it + /// splits into (a name listed already keeps its own, but is left out of export when either was), + /// and with automatic XMP writing on, the repaired photos' sidecars are written as a command's are. pub fn split_multiline_keywords(&mut self) -> usize { + let breaks = |k: &str| k.contains(['\r', '\n', '\u{2028}', '\u{2029}']); + let log_start = self.pending_log.len(); + let listed: Vec<(String, lightcraft_catalog::keywords::KeywordInfo)> = + self.catalog.listed_keywords().filter(|k| breaks(&k.path)).map(|k| (k.path.clone(), k.info.clone())).collect(); + for (path, info) in listed { + let mut ops = Vec::new(); + for name in lightcraft_catalog::keywords::from_file(std::slice::from_ref(&path), &[]) { + let moved = match self.catalog.keyword_info(&name) { + Some(kept) => { + let mut kept = kept.clone(); + kept.include_on_export &= info.include_on_export; + kept + } + None => info.clone(), + }; + ops.push(lightcraft_catalog::Op::SetKeyword { path: name, info: Some(moved) }); + } + ops.push(lightcraft_catalog::Op::SetKeyword { path, info: None }); + for op in ops { + match self.catalog.apply(op.clone()) { + Ok(_) => self.pending_log.push(op), + Err(e) => log::warn!("split keywords: {e}"), + } + } + } let fix: Vec<(lightcraft_catalog::PhotoId, lightcraft_catalog::Meta)> = self .catalog .photos() - .filter(|p| p.meta.keywords.iter().any(|k| k.contains(['\r', '\n', '\u{2028}', '\u{2029}']))) + .filter(|p| p.meta.keywords.iter().any(|k| breaks(k))) .map(|p| { let mut meta = p.meta.clone(); meta.keywords = lightcraft_catalog::keywords::from_file(&meta.keywords, &[]); @@ -692,6 +720,10 @@ impl Session { if n > 0 { log::info!("split the line-separated keywords of {n} photo(s) into one keyword a line"); } + // not run through a command, so the sidecars are written here, as after a command + if self.xmp.auto_write && self.pending_log.len() > log_start { + self.auto_write_sidecars_since(log_start); + } n } diff --git a/crates/engine/src/tests/keyword_list.rs b/crates/engine/src/tests/keyword_list.rs index 6f6f600af8..4e5531fd45 100644 --- a/crates/engine/src/tests/keyword_list.rs +++ b/crates/engine/src/tests/keyword_list.rs @@ -498,3 +498,27 @@ fn line_separated_keywords_are_split_when_the_library_opens() { assert_eq!(s.catalog.photo(id).unwrap().meta.keywords, vec!["Bride", "Groom", "Happy Couple"]); assert_eq!(s.split_multiline_keywords(), 0, "nothing left to split"); } + +/// A listed keyword with line breaks hands its options to the names it splits into, so a keyword left +/// out of export stays out (CodeRabbit on #2922); a name listed already keeps its own options but is +/// left out of export when either was. +#[test] +fn a_split_keyword_keeps_its_export_options() { + use lightcraft_catalog::Op; + use lightcraft_catalog::keywords::KeywordInfo; + let mut s = Session::with_demo(); + let id = s.visible_cloned()[0]; + let hidden = KeywordInfo { include_on_export: false, ..KeywordInfo::default() }; + let groom = KeywordInfo { person: true, ..KeywordInfo::default() }; + s.catalog.apply(Op::SetKeyword { path: "Bride\nGroom".into(), info: Some(hidden) }).unwrap(); + s.catalog.apply(Op::SetKeyword { path: "Groom".into(), info: Some(groom) }).unwrap(); + let mut meta = s.catalog.photo(id).unwrap().meta.clone(); + meta.keywords = vec!["Bride\nGroom".into()]; + s.catalog.apply(Op::SetMeta { id, meta: Box::new(meta) }).unwrap(); + assert_eq!(s.split_multiline_keywords(), 1); + let bride = s.catalog.keyword_info("Bride").expect("Bride is listed with the options it came with"); + assert!(!bride.include_on_export, "{bride:?}"); + let groom = s.catalog.keyword_info("Groom").unwrap(); + assert!(!groom.include_on_export && groom.person, "kept its own options, left out of export: {groom:?}"); + assert!(s.catalog.keyword_info("Bride\nGroom").is_none(), "the multi-line record is gone"); +} diff --git a/crates/engine/src/tests/xmp.rs b/crates/engine/src/tests/xmp.rs index a9314c2173..ed862426e2 100644 --- a/crates/engine/src/tests/xmp.rs +++ b/crates/engine/src/tests/xmp.rs @@ -263,6 +263,25 @@ fn reading_metadata_leaves_the_sidecar_alone_with_auto_write_on() { let _ = std::fs::remove_dir_all(&src); } +/// The open-time keyword repair runs outside a command, so it writes the repaired photos' sidecars itself +/// when automatic XMP writing is on (CodeRabbit on #2922): another app reading the sidecar sees one keyword a line. +#[test] +fn the_keyword_repair_writes_the_sidecar_with_auto_write_on() { + let src = temp_dir("split-keywords-autowrite"); + write_png(&src.join("frame.png"), 6); + let mut s = Session::new().with_fs(); + s.execute("library.import", &json!({"paths": [src.to_string_lossy()]})).unwrap(); + s.execute("library.xmpPreferences", &json!({"autoWrite": true})).unwrap(); + let id = only(&s); + let mut meta = s.catalog.photo(id).unwrap().meta.clone(); + meta.keywords = vec!["Bride\r\nGroom".into()]; + s.catalog.apply(lightcraft_catalog::Op::SetMeta { id, meta: Box::new(meta) }).unwrap(); + assert_eq!(s.split_multiline_keywords(), 1); + let xmp = std::fs::read_to_string(src.join("frame.xmp")).expect("the sidecar is written"); + assert!(xmp.contains(">Bride<") && xmp.contains(">Groom<") && !xmp.contains("Bride\r") && !xmp.contains("Bride\n"), "{xmp}"); + let _ = std::fs::remove_dir_all(&src); +} + /// Issue #934, the round trip the write-back broke: after a read with auto-write on, another app /// changes `crs:Exposure2012` from 0.5 to 1.2 (keeping the rest of the file), and the next read /// takes 1.2. From c688e0ec54bf36b8a9f528950c250dafddd62b94 Mon Sep 17 00:00:00 2001 From: OneSlips Date: Sun, 1 Nov 2026 07:23:26 +1000 Subject: [PATCH 6/8] FIX-KEYWORDS: a split keyword that new keywords go inside hands that to its first name only (CodeRabbit, #2922) Every split name took the whole record, so a default parent split into several names left the library with several, and Catalog::default_keyword_parent picked the first listed. Now only the first name it splits into keeps new_keywords_inside. Test: a_split_default_parent_stays_one_keyword. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/library.rs | 5 +++-- crates/engine/src/tests/keyword_list.rs | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/library.rs b/crates/engine/src/library.rs index e591511d8b..4a058f0ed1 100644 --- a/crates/engine/src/library.rs +++ b/crates/engine/src/library.rs @@ -680,14 +680,15 @@ impl Session { self.catalog.listed_keywords().filter(|k| breaks(&k.path)).map(|k| (k.path.clone(), k.info.clone())).collect(); for (path, info) in listed { let mut ops = Vec::new(); - for name in lightcraft_catalog::keywords::from_file(std::slice::from_ref(&path), &[]) { + for (i, name) in lightcraft_catalog::keywords::from_file(std::slice::from_ref(&path), &[]).into_iter().enumerate() { let moved = match self.catalog.keyword_info(&name) { Some(kept) => { let mut kept = kept.clone(); kept.include_on_export &= info.include_on_export; kept } - None => info.clone(), + // where new keywords go stays one keyword: the first name it splits into + None => lightcraft_catalog::keywords::KeywordInfo { new_keywords_inside: info.new_keywords_inside && i == 0, ..info.clone() }, }; ops.push(lightcraft_catalog::Op::SetKeyword { path: name, info: Some(moved) }); } diff --git a/crates/engine/src/tests/keyword_list.rs b/crates/engine/src/tests/keyword_list.rs index 4e5531fd45..6d0bc203bd 100644 --- a/crates/engine/src/tests/keyword_list.rs +++ b/crates/engine/src/tests/keyword_list.rs @@ -522,3 +522,18 @@ fn a_split_keyword_keeps_its_export_options() { assert!(!groom.include_on_export && groom.person, "kept its own options, left out of export: {groom:?}"); assert!(s.catalog.keyword_info("Bride\nGroom").is_none(), "the multi-line record is gone"); } + +/// A split keyword that is where new keywords go hands that to one of its names only, so there is still one +/// default parent (CodeRabbit on #2922). +#[test] +fn a_split_default_parent_stays_one_keyword() { + use lightcraft_catalog::Op; + use lightcraft_catalog::keywords::KeywordInfo; + let mut s = Session::with_demo(); + let inside = KeywordInfo { new_keywords_inside: true, ..KeywordInfo::default() }; + s.catalog.apply(Op::SetKeyword { path: "Ceremony\nReception".into(), info: Some(inside) }).unwrap(); + s.split_multiline_keywords(); + let parents: Vec<&str> = s.catalog.listed_keywords().filter(|k| k.info.new_keywords_inside).map(|k| k.path.as_str()).collect(); + assert_eq!(parents, ["Ceremony"]); + assert_eq!(s.catalog.default_keyword_parent().as_deref(), Some("Ceremony")); +} From 225718bc8b10b3dda672996499951e1079a48c15 Mon Sep 17 00:00:00 2001 From: OneSlips Date: Sun, 1 Nov 2026 09:26:46 +1000 Subject: [PATCH 7/8] FIX-KEYWORDS: the first split name stays the default parent when it is listed already (CodeRabbit, #2922) Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/library.rs | 6 ++++-- crates/engine/src/tests/keyword_list.rs | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/library.rs b/crates/engine/src/library.rs index 4a058f0ed1..2a1a71232d 100644 --- a/crates/engine/src/library.rs +++ b/crates/engine/src/library.rs @@ -681,14 +681,16 @@ impl Session { for (path, info) in listed { let mut ops = Vec::new(); for (i, name) in lightcraft_catalog::keywords::from_file(std::slice::from_ref(&path), &[]).into_iter().enumerate() { + // where new keywords go stays one keyword: the first name it splits into, listed already or not + let parent = info.new_keywords_inside && i == 0; let moved = match self.catalog.keyword_info(&name) { Some(kept) => { let mut kept = kept.clone(); kept.include_on_export &= info.include_on_export; + kept.new_keywords_inside |= parent; kept } - // where new keywords go stays one keyword: the first name it splits into - None => lightcraft_catalog::keywords::KeywordInfo { new_keywords_inside: info.new_keywords_inside && i == 0, ..info.clone() }, + None => lightcraft_catalog::keywords::KeywordInfo { new_keywords_inside: parent, ..info.clone() }, }; ops.push(lightcraft_catalog::Op::SetKeyword { path: name, info: Some(moved) }); } diff --git a/crates/engine/src/tests/keyword_list.rs b/crates/engine/src/tests/keyword_list.rs index 6d0bc203bd..bee5a65a77 100644 --- a/crates/engine/src/tests/keyword_list.rs +++ b/crates/engine/src/tests/keyword_list.rs @@ -537,3 +537,20 @@ fn a_split_default_parent_stays_one_keyword() { assert_eq!(parents, ["Ceremony"]); assert_eq!(s.catalog.default_keyword_parent().as_deref(), Some("Ceremony")); } + +/// The first name a default parent splits into stays the default parent when it is listed already (its other +/// options are its own). +#[test] +fn a_split_default_parent_stays_one_when_its_first_name_is_listed() { + use lightcraft_catalog::Op; + use lightcraft_catalog::keywords::KeywordInfo; + let mut s = Session::with_demo(); + let own = KeywordInfo { include_on_export: true, ..KeywordInfo::default() }; + s.catalog.apply(Op::SetKeyword { path: "Ceremony".into(), info: Some(own) }).unwrap(); + let inside = KeywordInfo { new_keywords_inside: true, ..KeywordInfo::default() }; + s.catalog.apply(Op::SetKeyword { path: "Ceremony\nReception".into(), info: Some(inside) }).unwrap(); + s.split_multiline_keywords(); + let parents: Vec<&str> = s.catalog.listed_keywords().filter(|k| k.info.new_keywords_inside).map(|k| k.path.as_str()).collect(); + assert_eq!(parents, ["Ceremony"]); + assert_eq!(s.catalog.default_keyword_parent().as_deref(), Some("Ceremony")); +} From 2a93627cabe8c38dd47e703632e618f49b61e75c Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Thu, 26 Nov 2026 22:31:50 +0700 Subject: [PATCH 8/8] Format import/job.rs as main's gate requires (rustfmt) The #1995 merge left crates/engine/src/import/job.rs unformatted on main, so the gate fails at fmt for every branch; this is that file run through rustfmt, nothing else. --- crates/engine/src/import/job.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/import/job.rs b/crates/engine/src/import/job.rs index 7ff684a75a..1d6761531b 100644 --- a/crates/engine/src/import/job.rs +++ b/crates/engine/src/import/job.rs @@ -398,15 +398,13 @@ impl ImportJob { let external_sidecar = if skip_sidecar { None } else { - found_sidecar - .and_then(|f| std::fs::read_to_string(f).ok()) - .and_then(|x| match crate::sidecar::parse_sidecar(&x, target) { - Ok(sc) => Some(sc), - Err(e) => { - log::warn!("import {path}: XMP: {e}"); - None - } - }) + found_sidecar.and_then(|f| std::fs::read_to_string(f).ok()).and_then(|x| match crate::sidecar::parse_sidecar(&x, target) { + Ok(sc) => Some(sc), + Err(e) => { + log::warn!("import {path}: XMP: {e}"); + None + } + }) }; let sidecar = match (embedded_sidecar, external_sidecar) { (Some(mut embedded), Some(external)) => {