LRC-LIB-KEYWORDS: names left out of a keyword list show on one line
A keyword with a line break in its name split the export toast in two. Names left out now show escaped (Line\nbreak). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
060da5bb5e
commit
4e9cffe375
|
|
@ -1416,7 +1416,8 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option<Re
|
|||
if !left.is_empty() {
|
||||
msg.push_str(&crate::i18n::tr_format!(
|
||||
" — left out, as a keyword list can't hold them: {names}",
|
||||
names = left.iter().take(5).copied().collect::<Vec<_>>().join(" · ")
|
||||
// escaped: a line break in a name would break the toast
|
||||
names = left.iter().take(5).map(|n| n.escape_debug().to_string()).collect::<Vec<_>>().join(" · ")
|
||||
));
|
||||
}
|
||||
app.toast(&ctx, msg);
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@ fn exporting_keywords_names_what_it_left_out() {
|
|||
let r = run(&mut h, "file.exportKeywords", json!({"path": path.to_string_lossy()}));
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
assert!(toast(&h).contains("Travel|[draft]"), "{}", toast(&h));
|
||||
// a name with a line break in it shows on one line
|
||||
run(&mut h, "photo.setMeta", json!({"ids": [id], "addKeywords": ["Line\nbreak"]}));
|
||||
run(&mut h, "file.exportKeywords", json!({"path": path.to_string_lossy()}));
|
||||
assert!(toast(&h).contains("Line\\nbreak") && !toast(&h).contains('\n'), "{}", toast(&h));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue