diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 7ab031e6..1e8aedfb 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -1416,7 +1416,8 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option>().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::>().join(" · ") )); } app.toast(&ctx, msg); diff --git a/crates/ui-egui/src/tests_keyword_files.rs b/crates/ui-egui/src/tests_keyword_files.rs index 9228efd4..f7180c31 100644 --- a/crates/ui-egui/src/tests_keyword_files.rs +++ b/crates/ui-egui/src/tests_keyword_files.rs @@ -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); }