diff --git a/crates/catalog/src/keywords.rs b/crates/catalog/src/keywords.rs index f3157641b7..ccc892044a 100644 --- a/crates/catalog/src/keywords.rs +++ b/crates/catalog/src/keywords.rs @@ -86,17 +86,39 @@ pub fn to_file(keywords: &[String]) -> FileKeywords { /// 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; diff --git a/crates/catalog/src/keywords/tests.rs b/crates/catalog/src/keywords/tests.rs index 343a5cac34..284135daf4 100644 --- a/crates/catalog/src/keywords/tests.rs +++ b/crates/catalog/src/keywords/tests.rs @@ -1,6 +1,18 @@ use super::*; use crate::{Filter, Photo, PhotoId, Source}; +/// 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()); +} + fn lib(kws: &[&[&str]]) -> (Catalog, Vec) { let mut c = Catalog::new(); let mut ids = Vec::new(); diff --git a/crates/engine/src/library.rs b/crates/engine/src/library.rs index 3102d66cfe..ab5dfea24c 100644 --- a/crates/engine/src/library.rs +++ b/crates/engine/src/library.rs @@ -758,6 +758,13 @@ impl Session { lib.forgot_local = Some(plan); } } + // keywords read whole from a list a line long (before they were split) become one each + 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}"); + } // 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 { @@ -770,6 +777,68 @@ 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. 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 (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 + } + None => lightcraft_catalog::keywords::KeywordInfo { new_keywords_inside: parent, ..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| breaks(k))) + .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"); + } + // 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 + } + /// Write pending ops to the log (fsynced, or handed to the log's own thread natively), 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 f2e12385bc..c40c7e3a0d 100644 --- a/crates/engine/src/tests/keyword_list.rs +++ b/crates/engine/src/tests/keyword_list.rs @@ -537,3 +537,73 @@ 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"); +} + +/// 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"); +} + +/// 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")); +} + +/// 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")); +} diff --git a/crates/engine/src/tests/xmp.rs b/crates/engine/src/tests/xmp.rs index cc79b5165c..c17ec5bc6b 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. diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 7950666896..ce620876ee 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1897,7 +1897,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 026c10fd7f..bd7117b112 100644 --- a/crates/ui-egui/src/panels/keyword_list.rs +++ b/crates/ui-egui/src/panels/keyword_list.rs @@ -136,7 +136,7 @@ pub fn drag_feedback(app: &mut LightcraftApp, ctx: &egui::Context) { } let frame = ctx.cumulative_frame_nr(); let hint = ctx.data(|d| d.get_temp::<(u64, String)>(egui::Id::unique(KEYWORD_HINT))).filter(|(f, _)| *f == frame).map(|(_, text)| text); - let name = hint.unwrap_or_else(|| keyword.rsplit('|').next().unwrap_or(&keyword).to_string()); + let name = hint.unwrap_or_else(|| 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| { @@ -171,12 +171,34 @@ 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() +} + +/// 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('|', " › ") +} + +/// 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) { 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()); @@ -218,7 +240,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 { @@ -284,7 +306,8 @@ fn row(app: &mut LightcraftApp, ui: &mut egui::Ui, r: &Row, selection: &[PhotoId let measure = |s: &str| ui.painter().layout_no_wrap(s.to_string(), font.clone(), t.text_label).size().x; let marks = if is_default { 10.0 } else { 0.0 } + if in_shortcut { 5.0 + measure("+") } else { 0.0 }; let room = (arrow.left() - 4.0 - (x + 34.0) - marks).max(0.0); - 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 let mut after = label.right(); @@ -301,7 +324,7 @@ fn row(app: &mut LightcraftApp, ui: &mut egui::Ui, r: &Row, selection: &[PhotoId ui.interact(plus, egui::Id::unique(("keyword-list-shortcut", r.path.to_lowercase())), Sense::hover()) .on_hover_text(crate::i18n::tr("Part of the keyword shortcut")); } - 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()); } @@ -316,7 +339,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)) @@ -370,7 +393,7 @@ fn drop_photos_on_keyword(app: &mut LightcraftApp, ui: &mut egui::Ui, ids: &[u64 } return; } - let keyword = path.replace('|', " › "); + let keyword = hover_path(path); super::grid::drag_hint( ui.ctx(), crate::i18n::tr_format!("Add “{keyword}” to {n} photo{}", if n == 1 { "" } else { "s" }, keyword = keyword, n = n), @@ -384,7 +407,7 @@ fn drop_photos_on_keyword(app: &mut LightcraftApp, ui: &mut egui::Ui, ids: &[u64 /// Gives the keyword `path` to the dragged photos and toasts how many (`n`) lacked it. fn give_keyword(app: &mut LightcraftApp, ctx: &egui::Context, ids: &[u64], path: &str, n: usize) { - let keyword = path.replace('|', " › "); + let keyword = hover_path(path); match app.run("photo.setMeta", json!({"ids": ids, "addKeywords": [path]})) { Ok(_) => app.toast(ctx, crate::i18n::tr_format!("Added “{keyword}” to {n} photo{}", if n == 1 { "" } else { "s" }, keyword = keyword, n = n)), Err(e) => app.toast(ctx, e), @@ -393,7 +416,7 @@ fn give_keyword(app: &mut LightcraftApp, ctx: &egui::Context, ids: &[u64], path: /// 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); @@ -657,6 +680,36 @@ 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)); + } + + /// 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:?}"); + } + + /// 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(); diff --git a/crates/ui-egui/src/panels/left/keywords.rs b/crates/ui-egui/src/panels/left/keywords.rs index 72190166b5..bedb5b4fa8 100644 --- a/crates/ui-egui/src/panels/left/keywords.rs +++ b/crates/ui-egui/src/panels/left/keywords.rs @@ -37,7 +37,7 @@ fn keyword_row(app: &mut LightcraftApp, ui: &mut egui::Ui, n: &KeywordNode, id: let inside = if n.children.iter().any(|c| !c.children.is_empty()) { Inside::OpensAndFolds } else { Inside::Alone }; tree_toggle(ui, &resp, indent, k, open, format!("keywordToggle:{}", n.path), &n.name, inside); } - 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); @@ -63,3 +63,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:?}"); + } + } +} diff --git a/crates/ui-egui/src/panels/left/rows.rs b/crates/ui-egui/src/panels/left/rows.rs index 40598a00b2..368e4cd448 100644 --- a/crates/ui-egui/src/panels/left/rows.rs +++ b/crates/ui-egui/src/panels/left/rows.rs @@ -157,6 +157,10 @@ impl<'a> Row<'a> { fn draw_row(app: &mut LightcraftApp, ui: &mut egui::Ui, row: Row) -> egui::Response { let Row { id, icon, label, spoken, count, selected, indent, sense, mark } = row; 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); @@ -242,7 +246,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); let mark_w = if mark { MARK_W } else { 0.0 }; let mut needed = row_need(indent, name_w, mark_w, count_w); 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 486fae309a..34323b0e21 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -718,7 +718,7 @@ From `08-lightroom-classic-extras.md` (Classic-only features) and part 2 of `06- | LRC-LIB-STACKS | Stacks (full) | P1 | ✅ | `crates/catalog/src/stacks.rs`, `cmd:stack.group`, `cmd:stack.split`, `cmd:stack.moveUp`, `cmd:stack.moveDown` | group / ungroup / toggle / set top / remove / auto by time / split / move up and down | | LRC-LIB-VC | Virtual copies | P1 | ✅ | `cmd:photo.virtualCopy` | ⌘' | | LRC-LIB-LABELS | Colour-label sets | P1 | ✅ | `cmd:label.sets`, `cmd:label.applySet`, `cmd:label.saveSet`, `cmd:label.deleteSet`, `cmd:label.setNames`, `crates/engine/src/cmd/manage.rs` | built-in Colors / Review sets + user sets (Photo ▸ Set Color Label, Edit Label Names… dialog); names written to and read from `xmp:Label` | -| LRC-LIB-KEYWORDS | Hierarchical keywords, sets, painter, Keyword List | P1 | ✅ | `crates/catalog/src/keywords.rs`, `crates/ui-egui/src/panels/keyword_list.rs`, `cmd:keyword.list`, `cmd:keyword.create`, `cmd:keyword.edit`, `cmd:keyword.move`, `cmd:keyword.info`, `cmd:keyword.purgeUnused`, `cmd:keyword.setDefaultParent`, `cmd:keyword.sets`, `cmd:keyword.toggleFromSet`, `cmd:keyword.saveSet`, `cmd:keyword.nextSet`, `cmd:keyword.previousSet`, `cmd:tool.keywordPainter`, `cmd:tool.enablePainting` | hierarchical `a\|b\|c` keywords (tree, parent filters include children, rename moves children); keyword sets + Recent Keywords (⌥1–⌥9; ⌥0 / ⌥⇧0 go to the next / previous set and wrap around at either end); keyword painter (Keywords panel ▸ Paint: click photos in the grid to toggle a keyword, Esc stops; Photo ▸ Enable Painting, ⌘⌥K / Ctrl+Alt+K, paints the painter box's keyword, stops painting when pressed again, and with the box empty opens the Keywords panel). Keyword List (Keywords panel): every keyword, those without photos too (a keyword list in the catalog, format version 4), with counts, a filter box, a tri-state tick box for the selection and an arrow to show its photos; + / Create Keyword Tag (name, synonyms, put inside, add to selected photos), double-click / Edit Keyword Tag, − / Delete with confirmation, context menu (create inside, Put New Keywords Inside This Keyword, purge unused keywords); drag a keyword onto another to nest it or onto the list's title for the top level (a merge asks first), drag photos onto a keyword to tag them (the dragged label says how many photos get it; when all have it, it says so and a drop does nothing); a keyword dragged over itself or what is inside it shows the not-allowed cursor and says why; Esc gives up a drag. The list is there without a selection too; Put New Keywords Inside This Keyword (kept with the keyword in the library, undoable) also places new keywords typed in the Keywords panel. Keyword tag options include on export, export containing keywords and export synonyms shape exported files (names in `dc:subject`, paths in `lr:hierarchicalSubject`), and files' `lr:hierarchicalSubject` paths come back as keywords on import and from sidecars; Person is stored only. Keywording box (`crates/ui-egui/src/panels/keywording.rs`): the selection's keywords as chips (one only some selected photos have marked with an asterisk; × only removes, from every selected photo; with no selection, the active photo's), an Enter Keywords / Keywords / & Containing / Will Export switch (Lightroom Classic's Keyword Tags views: the keywords as text or as chips to edit, them with their parents, what exported files carry), keyword-set buttons and suggestions that follow the selection, shared text fields for typing and painting. Enter Keywords (`keywordView:enter`, `field:enterKeywords`) shows the selection's keywords as text, commas between them and an asterisk after one only some selected photos have: Return or leaving the box applies the edit to the photos selected when it began as one undo step (a keyword left out comes off every one of them, a name typed goes to all of them, `>` and `<` mark a hierarchy as `\|` does (`animal > dog` and `dog < animal` are both `animal\|dog`), a marked keyword stays on the photos that have it and without its asterisk goes to all), Esc gives the edit up, another selection gives it up too, an asterisk after any other name is refused with the text kept, and containing keywords and synonyms stay out of the text (the rules for mixed keywords and for when an edit applies are LightCraft's own). Settings ▸ Interface ▸ Keywords of the selection ▸ Grouped by parent (`keywordChips: grouped` in the app settings; Whole names stays the default): keywords inside the same keyword share a line naming it (`keywordGroup:`: the deepest keyword a chip shares with another) and their chips say only what is below it, side by side; a list of more than ten lines stops after eight with “+N more” (`keywordChipsMore`, then `keywordChipsFewer`); the whole list is for the selection it was asked of, another selection's is short again, and the suggestions say the keyword's own name (its whole path when two share a name, and in the tooltip). The titles of Keywords and of the Keyword List fold their sections shut (`section:keywording`, `section:keywordList`; kept in the UI state as `foldedSections`), and a selection without keywords says “No keywords yet”. The Add keyword box offers the library's keywords for what is being typed (after the last comma) right under itself (`kwComplete:`, at most eight, those every selected photo has left out, a keyword spelled two ways once; above the box where the window has no room under it, and not at all while the box is scrolled out of the panel): ↓ / ↑ without Shift or Alt move through them (`kwCompleteAt:`; the highlight stays with its keyword when the library changes), Return or a click gives the highlighted one with the keywords typed before it and leaves the cursor in the box; with none highlighted Return gives what was typed, as before. As in Enter Keywords, `>` and `<` in a typed name mark a hierarchy as `\|` does, unless the name as written is a keyword the library has. A name the library doesn't have is announced as a new keyword, with the keyword it would go inside (`kwCompleteCreate`). The suggestions below no longer change while typing. A refused add says why and keeps the text. With several photos selected the box says how many its keywords are of (`keywordScope`); a chip's × is a target as tall as the chip and 22 pt wide that lights up on its own, and taking a keyword off several photos (× or the chip's menu) says which keyword, from how many photos, and that Edit ▸ Undo puts it back; a refused removal says why. Chips and their × show the keyboard focus. Edit Keyword Set (Keyword Set ▸ Edit Set…): a set's name and nine slots typed in place, empty slots kept so each keyword stays on its ⌥ key, a set renamed in place (`cmd:keyword.saveSet` `replace`) or saved as a new set (`new`, a taken name refused). File ▸ Import Keywords… / Export Keywords… (`cmd:keyword.import`, `cmd:keyword.export`): keyword list files in Lightroom Classic's format (tab-indented, `{synonym}`, `[left out of export]`), which Capture One, darktable, Bridge and Photo Supreme (its Formatted Vocabulary File) read and write too; import adds what is missing in one undo step, export names the keywords Capture One refuses (; , < >). The keyword shortcut (Set Keyword Shortcut, Use This as Keyword Shortcut, a + in the Keyword List, ⇧K) is under KEYC-METADATA. Not yet: synonyms in search, person keywords tied to faces, IPTC keywords in exported files (Piwigo, RawTherapee), hierarchy from digiKam / ACDSee / Microsoft XMP fields. In the Keyword List a keyword's empty box carries a dot when the selected photos have a keyword inside it (its tooltip names them), so a folded keyword shows that something in it is applied | +| LRC-LIB-KEYWORDS | Hierarchical keywords, sets, painter, Keyword List | P1 | ✅ | `crates/catalog/src/keywords.rs`, `crates/ui-egui/src/panels/keyword_list.rs`, `cmd:keyword.list`, `cmd:keyword.create`, `cmd:keyword.edit`, `cmd:keyword.move`, `cmd:keyword.info`, `cmd:keyword.purgeUnused`, `cmd:keyword.setDefaultParent`, `cmd:keyword.sets`, `cmd:keyword.toggleFromSet`, `cmd:keyword.saveSet`, `cmd:keyword.nextSet`, `cmd:keyword.previousSet`, `cmd:tool.keywordPainter`, `cmd:tool.enablePainting` | hierarchical `a\|b\|c` keywords (tree, parent filters include children, rename moves children); keyword sets + Recent Keywords (⌥1–⌥9; ⌥0 / ⌥⇧0 go to the next / previous set and wrap around at either end); keyword painter (Keywords panel ▸ Paint: click photos in the grid to toggle a keyword, Esc stops; Photo ▸ Enable Painting, ⌘⌥K / Ctrl+Alt+K, paints the painter box's keyword, stops painting when pressed again, and with the box empty opens the Keywords panel). Keyword List (Keywords panel): every keyword, those without photos too (a keyword list in the catalog, format version 4), with counts, a filter box, a tri-state tick box for the selection and an arrow to show its photos; + / Create Keyword Tag (name, synonyms, put inside, add to selected photos), double-click / Edit Keyword Tag, − / Delete with confirmation, context menu (create inside, Put New Keywords Inside This Keyword, purge unused keywords); drag a keyword onto another to nest it or onto the list's title for the top level (a merge asks first), drag photos onto a keyword to tag them (the dragged label says how many photos get it; when all have it, it says so and a drop does nothing); a keyword dragged over itself or what is inside it shows the not-allowed cursor and says why; Esc gives up a drag. The list is there without a selection too; Put New Keywords Inside This Keyword (kept with the keyword in the library, undoable) also places new keywords typed in the Keywords panel. Keyword tag options include on export, export containing keywords and export synonyms shape exported files (names in `dc:subject`, paths in `lr:hierarchicalSubject`), and files' `lr:hierarchicalSubject` paths come back as keywords on import and from sidecars; Person is stored only. Keywording box (`crates/ui-egui/src/panels/keywording.rs`): the selection's keywords as chips (one only some selected photos have marked with an asterisk; × only removes, from every selected photo; with no selection, the active photo's), an Enter Keywords / Keywords / & Containing / Will Export switch (Lightroom Classic's Keyword Tags views: the keywords as text or as chips to edit, them with their parents, what exported files carry), keyword-set buttons and suggestions that follow the selection, shared text fields for typing and painting. Enter Keywords (`keywordView:enter`, `field:enterKeywords`) shows the selection's keywords as text, commas between them and an asterisk after one only some selected photos have: Return or leaving the box applies the edit to the photos selected when it began as one undo step (a keyword left out comes off every one of them, a name typed goes to all of them, `>` and `<` mark a hierarchy as `\|` does (`animal > dog` and `dog < animal` are both `animal\|dog`), a marked keyword stays on the photos that have it and without its asterisk goes to all), Esc gives the edit up, another selection gives it up too, an asterisk after any other name is refused with the text kept, and containing keywords and synonyms stay out of the text (the rules for mixed keywords and for when an edit applies are LightCraft's own). Settings ▸ Interface ▸ Keywords of the selection ▸ Grouped by parent (`keywordChips: grouped` in the app settings; Whole names stays the default): keywords inside the same keyword share a line naming it (`keywordGroup:`: the deepest keyword a chip shares with another) and their chips say only what is below it, side by side; a list of more than ten lines stops after eight with “+N more” (`keywordChipsMore`, then `keywordChipsFewer`); the whole list is for the selection it was asked of, another selection's is short again, and the suggestions say the keyword's own name (its whole path when two share a name, and in the tooltip). The titles of Keywords and of the Keyword List fold their sections shut (`section:keywording`, `section:keywordList`; kept in the UI state as `foldedSections`), and a selection without keywords says “No keywords yet”. The Add keyword box offers the library's keywords for what is being typed (after the last comma) right under itself (`kwComplete:`, at most eight, those every selected photo has left out, a keyword spelled two ways once; above the box where the window has no room under it, and not at all while the box is scrolled out of the panel): ↓ / ↑ without Shift or Alt move through them (`kwCompleteAt:`; the highlight stays with its keyword when the library changes), Return or a click gives the highlighted one with the keywords typed before it and leaves the cursor in the box; with none highlighted Return gives what was typed, as before. As in Enter Keywords, `>` and `<` in a typed name mark a hierarchy as `\|` does, unless the name as written is a keyword the library has. A name the library doesn't have is announced as a new keyword, with the keyword it would go inside (`kwCompleteCreate`). The suggestions below no longer change while typing. A refused add says why and keeps the text. With several photos selected the box says how many its keywords are of (`keywordScope`); a chip's × is a target as tall as the chip and 22 pt wide that lights up on its own, and taking a keyword off several photos (× or the chip's menu) says which keyword, from how many photos, and that Edit ▸ Undo puts it back; a refused removal says why. Chips and their × show the keyboard focus. Edit Keyword Set (Keyword Set ▸ Edit Set…): a set's name and nine slots typed in place, empty slots kept so each keyword stays on its ⌥ key, a set renamed in place (`cmd:keyword.saveSet` `replace`) or saved as a new set (`new`, a taken name refused). File ▸ Import Keywords… / Export Keywords… (`cmd:keyword.import`, `cmd:keyword.export`): keyword list files in Lightroom Classic's format (tab-indented, `{synonym}`, `[left out of export]`), which Capture One, darktable, Bridge and Photo Supreme (its Formatted Vocabulary File) read and write too; import adds what is missing in one undo step, export names the keywords Capture One refuses (; , < >). The keyword shortcut (Set Keyword Shortcut, Use This as Keyword Shortcut, a + in the Keyword List, ⇧K) is under KEYC-METADATA. Not yet: synonyms in search, person keywords tied to faces, IPTC keywords in exported files (Piwigo, RawTherapee), hierarchy from digiKam / ACDSee / Microsoft XMP fields. In the Keyword List a keyword's empty box carries a dot when the selected photos have a keyword inside it (its tooltip names them), so a folded keyword shows that something in it is applied; a keyword list a file writes as one `dc:subject` / `lr:hierarchicalSubject` entry with a keyword a line is read as one keyword a line, a library already holding such a keyword is repaired when it opens, and the sidebar and Keyword List draw a name on one line (`crates/catalog/src/keywords.rs`, `crates/engine/src/tests/keyword_list.rs`, `crates/ui-egui/src/tests/keyword_sidebar.rs`) | | LRC-LIB-METADATA | Metadata panel & presets | P1 | ✅ | `cmd:photo.setMeta`, `cmd:metadata.savePreset`, `cmd:metadata.applyPreset`, `cmd:metadata.presets`, `cmd:metadata.deletePreset`, `cmd:dialog.captureTime` | IPTC core, accessibility, place, capture-time edit; copyright status (unknown / copyrighted / public domain), rights usage terms and copyright info URL (`photo.setMeta` `copyrightStatus`, `usageTerms`, `copyrightUrl`; XMP Rights Management fields, kept by "copyright only" exports, a smart-album rule); metadata presets (Photo → Metadata Preset, Save Metadata Preset… from the active photo; applied on import from Settings) | | LRC-LIB-QUICKDEV | Quick develop | P2 | ✅ | `cmd:develop.quickAdjust`, `crates/ui-egui/src/panels/edit.rs` (`quick_develop`) | grid with several photos selected: Edit panel ▸ Quick Develop steps (exposure ⅓ / 1 stop, contrast, highlights, shadows, whites, blacks, clarity, vibrance, temperature) added to each photo's own value, one undo step | | LRC-LIB-PEOPLE | People view | P2 | 🟡 | `cmd:view.people`, `cmd:view.person`, `cmd:faces.person`, `cmd:faces.unnamed`, `cmd:faces.nameFaces`, `crates/ui-egui/src/panels/people.rs`, `crates/ui-egui/src/panels/person.rs`, `crates/ui-egui/src/panels/unnamed.rs`, `crates/engine/src/face_tiles.rs` | Named People cards (face close-up, the photo count on the picture, name) for the photos the active filters let through, with the filter chips shown above them, sized by the thumbnail slider. Below them the **Unnamed faces**: every face nobody has named as a cropped picture, look-alikes next to each other once recognition has looked at them, a suggested name on a face the named ones recognise; click or Shift-click to select, type a name, Enter names the whole group in one undo step. A click on a person opens their page: only cropped faces, then **More** (unnamed faces that look like them, best first; click to confirm one, × to hide for the session, or ↑ / hovered-or-focused A key to confirm all currently shown non-hidden suggestions at or above that face's score, including ties, in one undo step). Every face is shown by the detector's box where the scan has one, so faces are equally close. Until recognition is set up a line at the top offers the next step (Settings ▸ Faces, or Turn on), as does the loupe's name box. Face pictures of unedited raws are cut from the largest embedded preview (planned read: header and JPEG only, never the sensor data) when it holds at least ¾ of the tile's pixels across the face, else developed as before; all are kept in the thumbnail disk cache at 16 px size steps, so a later launch shows them without reading the originals (#1440, `docs/faces.md`). No clusters with separators between groups, no persistent reject, no merge of two people @@ -828,6 +828,7 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | 2026-11-04 | patch | LR-MASK-OBJECTS, #2574: remote SAM worker retries transient listener accept errors after 100 ms; client failures remain isolated; feature counts unchanged | | 2026-10-28 | minor | LR-EDIT-OPTICS-PROFILE: lensfun's database offered once on the first launch and downloaded on request (Download / Not Now, Settings) (pinned, CC BY-SA, never bundled), the library looked up when it arrives or Enable Lens Corrections is ticked, the Optics panel names the profile or the lens without one; status unchanged (🟡) | | 2026-10-26 | minor | LR-BEHAV-PANEL-RESIZE, KEY-INFO: closing a tool panel (Crop, Remove, Masking, Red Eye) puts back the panel shown before it, hidden if it was hidden, at the same width and scroll position; a panel key or button (I, M, C, H…) pressed again puts back exactly what the right column showed before it (Edit → I → I = Edit, closed → I → I = closed); status unchanged (✅) | +| 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-30 | patch | LR-BEHAV-ACCESS: the Flatpak manifests grant `--talk-name=org.a11y.Bus`, so AccessKit can find out whether a screen reader is running and publish the window inside the sandbox; packaging lint requires it in both manifests; status unchanged (🟡), not tried with Orca | | 2026-10-27 | patch | LR-LIB-LABEL, MENU-PHOTO-LABEL, KEY-LABELS: Clear Color Label (`photo.clearLabel`) is a command of its own, so Help → Keyboard Shortcuts can give it a key (#2980); the Photo ▸ Set Color Label ▸ None row runs it; status unchanged | | 2026-10-25 | minor | KEYC-METADATA, LRC-LIB-KEYWORDS: ⌘⌥⇧K / Ctrl+Alt+Shift+K (`dialog.keywordShortcut`, Set Keyword Shortcut) and ⇧K (`keyword.toggleShortcut`) add and remove the keyword shortcut's keywords; Keyword Shortcut leaves LRC-LIB-KEYWORDS' Not yet list; status counts unchanged (KEYC-METADATA stays 🟡) | diff --git a/docs/whats-new.md b/docs/whats-new.md index 6f4002d3ca..67e4c86086 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -457,6 +457,11 @@ - Fielded search tokens now take inclusive comparisons: `rating:>=3`, `iso:<=400`, `f:>=2.8`, `focal:<=50`. Before, the `=` was read as part of the number, so such a search quietly showed no photos at all. +### 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. + ### Import rename numbering stops safely at its limit - Copy and Move imports can use the last representable rename number once. If more renamed files remain, each is reported as failed with guidance to lower `renameStart` or leave `rename` blank; completed transfers stay