DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
File › Open Recent: recent documents in the menu and on the start screen (#706)
PiMinusMax1c82a5b892d5
diff --git a/ROADMAP.md b/ROADMAP.mdindex 8a0f82071..8e0b7a064 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -2,7 +2,7 @@**Stage: pre-alpha** · next: alpha, ~0% and ~15–25 h away; beta ~28 points and ~420–750 h beyond that (the core-workflow gate, not the percentage: ready for real work is already ~47%)-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (cancelable macOS Dock Quit) · **Target:** Adobe InDesign 2026+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (File ▸ Open Recent) · **Target:** Adobe InDesign 2026DesignCraft aims at full Adobe InDesign parity, and to be better: faster, open (documented JSONformat + IDML), scriptable by agents (MCP), and available on the web.@@ -129,6 +129,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.mNewest first.+- **2026-10-13** · File ▸ Open Recent lists the documents last opened or saved (newest first, no duplicates; Save a Copy and exports don't count), with Clear Recent Files; the start screen shows the last eight. A file that is gone is dimmed and says so when chosen, and stays listed. Preferences ▸ File Handling sets how many are kept (default 20, 0–100). `file.openRecent {index}`, `file.recentFiles`, `file.clearRecent` (#706). No readiness percentage change.- **2026-10-12** · macOS Dock Quit uses the same unsaved-document prompts as window and menu Quit. Repeated requests keep the current answers; Cancel retains every tab and unsaved recovery checkpoint, and completed Save/Don't Save answers exit through the ordinary event loop. No readiness percentage change.- **2026-10-12** · Orderly native exit writes the latest recovery state after finalizing current quit approvals; incomplete or stale plans keep their documents, and Undo to the saved state clears stale recovery. Unavailable or failed recovery is reported. Cancelable macOS Dock Quit remains open (#544). No readiness percentage change.- **2026-10-12** · Recovered documents keep a checkpoint until saved, closed or reverted, including a second crash before autosave. Restarted document IDs and explicit recovery folders preserve other snapshots; failed republishing retains the original. No readiness percentage change.diff --git a/apps/designcraft/src/native_menu.rs b/apps/designcraft/src/native_menu.rsindex f51db197a..40e06e405 100644--- a/apps/designcraft/src/native_menu.rs+++ b/apps/designcraft/src/native_menu.rs@@ -20,6 +20,16 @@ pub struct NativeMenu {_menu: Menu,items: HashMap<String, (String, Value, Handle)>,last_refresh: f64,+ /// File › Open Recent, rebuilt when the list of recent files changes.+ recent: Option<RecentMenu>,+}++struct RecentMenu {+ submenu: Submenu,+ /// The files shown, and the native items standing for them (with their trailing separator).+ shown: Vec<String>,+ ids: Vec<String>,+ separator: Option<PredefinedMenuItem>,}/// Accelerator for "Cmd+Shift+]" (modifier-less shortcuts stay in the app so typing works).@@ -35,6 +45,7 @@ impl NativeMenu {let menu = Menu::new();let mut items = HashMap::new();let mut counter = 0usize;+ let mut recent = None;// Application menu.let app_menu = Submenu::new("DesignCraft", true);// Our own About splash (with the community links) instead of the stock panel.@@ -60,7 +71,7 @@ impl NativeMenu {let _ = menu.append(&app_menu);for (title, entries) in menus::menu_tree() {let sub = Submenu::new(designcraft_ui_egui::i18n::tr(&app.ui.language, title), true);- build(app, &sub, &entries, &mut items, &mut counter);+ build(app, &sub, &entries, &mut items, &mut counter, title, &mut recent);let _ = menu.append(&sub);}menu.init_for_nsapp();@@ -72,7 +83,44 @@ impl NativeMenu {(p.is_null() && accel(sc).is_some()).then(|| id.clone())}).collect();- Self { _menu: menu, items, last_refresh: 0.0 }+ let recent = recent.map(|submenu| RecentMenu { submenu, shown: Vec::new(), ids: Vec::new(), separator: None });+ Self { _menu: menu, items, last_refresh: 0.0, recent }+ }++ /// Put the current recent files at the top of File › Open Recent when they changed.+ fn refresh_recent(&mut self, app: &DesignApp) {+ let Some(r) = self.recent.as_mut() else { return };+ if r.shown == app.session.prefs.recent_files {+ return;+ }+ for id in r.ids.drain(..) {+ if let Some((_, _, Handle::Plain(item))) = self.items.remove(&id) {+ let _ = r.submenu.remove(&item);+ }+ }+ if let Some(sep) = r.separator.take() {+ let _ = r.submenu.remove(&sep);+ }+ let mut position = 0;+ for it in menus::recent_items(app) {+ match it {+ Item::Cmd { label, id, params, .. } => {+ let mid = format!("dc-recent{position}");+ let item = MenuItem::with_id(mid.clone(), label, true, None);+ let _ = r.submenu.insert(&item, position);+ self.items.insert(mid.clone(), (id, params, Handle::Plain(item)));+ r.ids.push(mid);+ }+ Item::Sep => {+ let sep = PredefinedMenuItem::separator();+ let _ = r.submenu.insert(&sep, position);+ r.separator = Some(sep);+ }+ Item::Sub(..) => continue,+ }+ position += 1;+ }+ r.shown = app.session.prefs.recent_files.clone();}pub fn poll(&mut self, app: &mut DesignApp, ctx: &egui::Context) {@@ -86,6 +134,7 @@ impl NativeMenu {return;}self.last_refresh = now;+ self.refresh_recent(app);for (cmd, params, h) in self.items.values() {let en = menus::native_menu_enabled(app, ctx, cmd);match h {@@ -99,7 +148,15 @@ impl NativeMenu {}}-fn build(app: &DesignApp, parent: &Submenu, entries: &[Item], items: &mut HashMap<String, (String, Value, Handle)>, counter: &mut usize) {+fn build(+ app: &DesignApp,+ parent: &Submenu,+ entries: &[Item],+ items: &mut HashMap<String, (String, Value, Handle)>,+ counter: &mut usize,+ path: &str,+ recent: &mut Option<Submenu>,+) {for e in entries {match e {Item::Sep => {@@ -107,7 +164,11 @@ fn build(app: &DesignApp, parent: &Submenu, entries: &[Item], items: &mut HashMa}Item::Sub(label, children) => {let sub = Submenu::new(designcraft_ui_egui::i18n::tr(&app.ui.language, label), true);- build(app, &sub, children, items, counter);+ let path = format!("{path}/{label}");+ build(app, &sub, children, items, counter, &path, recent);+ if path == menus::OPEN_RECENT {+ *recent = Some(sub.clone());+ }let _ = parent.append(&sub);}Item::Cmd { label, id, params, shortcut } => {diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rsindex a1919b89e..98e3aa9df 100644--- a/crates/engine/src/cmd/file.rs+++ b/crates/engine/src/cmd/file.rs@@ -21,6 +21,16 @@ pub fn specs() -> Vec<CommandSpec> {"{path} — .designcraft or .idml; the fonts in a `Document Fonts` folder beside it load first → {index, documentFonts: faces loaded, warnings: font files skipped (and, for .idml, package parts missing)}",always, file_open),cmd!(noundo "file.openBytes", "Open Bytes", [], None, "{name, base64} — DesignCraft JSON or an IDML package", always, file_open_bytes),+ cmd!(noundo "file.openRecent", "Open Recent File", [], None,+ "{index} — reopen entry `index` of File › Open Recent (as file.open); a file that is gone is an error and stays listed",+ has_recent, file_open_recent),+ cmd!(query "file.recentFiles", "Recent Files", [], None, "{} → [{path, name, exists}] File › Open Recent, most recent first", always, |s, _| {+ Ok(Value::Array(s.prefs.recent_files.iter().map(|p| recent_entry(p)).collect()))+ }),+ cmd!(noundo "file.clearRecent", "Clear Recent Files", ["File", "Open Recent"], None, "{} — empty File › Open Recent", has_recent, |s, _| {+ s.prefs.recent_files.clear();+ ok()+ }),cmd!(noundo "file.save", "Save", ["File"], Some("Cmd+S"), "{path?}", has_doc, file_save),cmd!(noundo "file.saveAs", "Save As…", ["File"], Some("Cmd+Shift+S"), "{path}", has_doc, file_save),cmd!(noundo "file.saveACopy", "Save a Copy…", ["File"], None, "{path} — writes the document without changing which file it is or its unsaved state", has_doc, |s, p| {@@ -157,7 +167,46 @@ fn file_sample(s: &mut Session, _p: &Value) -> Result<Value> {Ok(json!({"index": i}))}+fn has_recent(s: &Session) -> std::result::Result<(), String> {+ if s.prefs.recent_files.is_empty() { Err("no recent files".into()) } else { Ok(()) }+}++/// One File › Open Recent row: the path, its file name and whether it is still there.+fn recent_entry(path: &str) -> Value {+ let name = std::path::Path::new(path).file_name().map_or_else(|| path.to_string(), |n| n.to_string_lossy().to_string());+ #[cfg(not(target_arch = "wasm32"))]+ let exists = std::path::Path::new(path).is_file();+ #[cfg(target_arch = "wasm32")]+ let exists = false;+ json!({"path": path, "name": name, "exists": exists})+}++fn file_open_recent(s: &mut Session, p: &Value) -> Result<Value> {+ let index =+ p.get("index").and_then(Value::as_u64).and_then(|i| usize::try_from(i).ok()).ok_or_else(|| bad("file.openRecent", "missing `index`"))?;+ let path = s+ .prefs+ .recent_files+ .get(index)+ .cloned()+ .ok_or_else(|| bad("file.openRecent", format!("no recent file {index} (the list has {})", s.prefs.recent_files.len())))?;+ #[cfg(not(target_arch = "wasm32"))]+ if !std::path::Path::new(&path).is_file() {+ return Err(EngineError::Other(format!("{path} can't be found: it was moved, renamed or deleted, or its disk isn't connected")));+ }+ file_open(s, &json!({"path": path}))+}++/// `file.open`: the document opens and moves to the front of File › Open Recent.fn file_open(s: &mut Session, p: &Value) -> Result<Value> {+ let r = open_path(s, p)?;+ if let Some(path) = str_param(p, "path") {+ s.prefs.note_recent_file(path);+ }+ Ok(r)+}++fn open_path(s: &mut Session, p: &Value) -> Result<Value> {let path = str_param(p, "path").ok_or_else(|| bad("file.open", "missing `path`"))?;#[cfg(not(target_arch = "wasm32"))]{@@ -259,6 +308,7 @@ fn file_save(s: &mut Session, p: &Value) -> Result<Value> {let recovery_dir = s.recovery_dir.clone();let index = s.active_index().ok_or(EngineError::NoDocument)?;crate::recovery::discard_document(s, index, recovery_dir.as_deref());+ s.prefs.note_recent_file(&path);}Ok(json!({"path": path, "bytes": bytes.len()}))}@@ -990,3 +1040,94 @@ mod document_fonts_tests {let _ = std::fs::remove_dir_all(&dir);}}++#[cfg(test)]+mod recent_tests {+ use serde_json::json;++ use crate::Session;++ fn temp_dir(name: &str) -> std::path::PathBuf {+ let dir = std::env::temp_dir().join(format!("dc-recent-{name}-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&dir);+ std::fs::create_dir_all(&dir).unwrap();+ dir+ }++ fn saved(s: &mut Session, path: &std::path::Path) -> String {+ s.execute("file.new", &json!({})).unwrap();+ s.execute("file.saveAs", &json!({"path": path.to_string_lossy()})).unwrap();+ path.to_string_lossy().to_string()+ }++ /// Opening and saving put a file at the front once; Save a Copy doesn't count.+ #[test]+ fn open_and_save_order_the_list_without_duplicates() {+ let dir = temp_dir("order");+ let mut s = Session::new();+ let a = saved(&mut s, &dir.join("a.designcraft"));+ let b = saved(&mut s, &dir.join("b.designcraft"));+ assert_eq!(s.prefs.recent_files, [b.clone(), a.clone()]);+ s.execute("file.open", &json!({"path": a})).unwrap();+ assert_eq!(s.prefs.recent_files, [a.clone(), b.clone()], "reopening moves it to the front, once");+ s.execute("file.saveACopy", &json!({"path": dir.join("copy.designcraft").to_string_lossy()})).unwrap();+ assert_eq!(s.prefs.recent_files, [a.clone(), b.clone()], "a copy isn't a recent file");+ let rows = s.execute("file.recentFiles", &json!({})).unwrap();+ assert_eq!(rows[0], json!({"path": a, "name": "a.designcraft", "exists": true}));+ let _ = std::fs::remove_dir_all(&dir);+ }++ #[test]+ fn open_recent_reopens_and_a_missing_file_is_an_error_that_keeps_it_listed() {+ let dir = temp_dir("open");+ let mut s = Session::new();+ let a = saved(&mut s, &dir.join("a.designcraft"));+ let b = saved(&mut s, &dir.join("b.designcraft"));+ let r = s.execute("file.openRecent", &json!({"index": 1})).unwrap();+ assert_eq!(s.documents()[r["index"].as_u64().unwrap() as usize].path.as_deref(), Some(a.as_str()));+ assert_eq!(s.prefs.recent_files, [a.clone(), b.clone()]);+ std::fs::remove_file(&b).unwrap();+ let e = s.execute("file.openRecent", &json!({"index": 1})).unwrap_err();+ assert!(e.to_string().contains("can't be found"), "{e}");+ assert_eq!(s.prefs.recent_files, [a.clone(), b.clone()], "a disk that isn't connected comes back");+ assert_eq!(s.execute("file.recentFiles", &json!({})).unwrap()[1]["exists"], false);+ // Hostile indices are errors, never panics.+ for index in [json!(2), json!(u64::MAX), json!(-1), json!("0"), json!(null)] {+ assert!(s.execute("file.openRecent", &json!({"index": index})).is_err(), "{index}");+ }+ s.execute("file.clearRecent", &json!({})).unwrap();+ assert!(s.prefs.recent_files.is_empty());+ assert!(s.execute("file.openRecent", &json!({"index": 0})).is_err(), "disabled when empty");+ let _ = std::fs::remove_dir_all(&dir);+ }++ #[test]+ fn the_list_keeps_at_most_the_preferred_count() {+ let mut s = Session::new();+ for i in 0..30 {+ s.prefs.note_recent_file(&format!("/work/{i}.designcraft"));+ }+ assert_eq!(s.prefs.recent_files.len(), 20, "default: 20");+ assert_eq!(s.prefs.recent_files[0], "/work/29.designcraft");+ s.execute("prefs.set", &json!({"recentFilesMax": 3})).unwrap();+ assert_eq!(s.prefs.recent_files, ["/work/29.designcraft", "/work/28.designcraft", "/work/27.designcraft"]);+ assert_eq!(s.execute("prefs.set", &json!({"recentFilesMax": 4_000_000_000u64})).unwrap()["recentFilesMax"], crate::MAX_RECENT_FILES);+ assert!(s.execute("prefs.set", &json!({"recentFilesMax": -1})).is_err());+ s.execute("prefs.set", &json!({"recentFilesMax": 0})).unwrap();+ s.prefs.note_recent_file("/work/new.designcraft");+ assert!(s.prefs.recent_files.is_empty(), "0 keeps no list");+ }++ /// The list is a preference: it survives the round trip through prefs.json.+ #[test]+ fn the_list_survives_a_restart() {+ let mut s = Session::new();+ s.prefs.note_recent_file("/work/a.designcraft");+ let saved = serde_json::to_vec(&s.prefs).unwrap();+ let back: crate::Prefs = serde_json::from_slice(&saved).unwrap();+ assert_eq!(back.recent_files, ["/work/a.designcraft"]);+ assert_eq!(back.recent_files_max, 20);+ let old: crate::Prefs = serde_json::from_slice(br#"{"recoveryMinutes": 2.0}"#).unwrap();+ assert!(old.recent_files.is_empty(), "older prefs.json without the list still load");+ }+}diff --git a/crates/engine/src/cmd/prefs.rs b/crates/engine/src/cmd/prefs.rsindex 68a5cf152..c74192c83 100644--- a/crates/engine/src/cmd/prefs.rs+++ b/crates/engine/src/cmd/prefs.rs@@ -48,13 +48,14 @@ pub fn specs() -> Vec<CommandSpec> {"Preferences",[],None,- "{showHiddenCharacters?, typographersQuotes?, polygonSides?, starInset?, scaleStrokes?, dimensionsIncludeStroke?, transformationsAreTotals?, absolutePageNumbers?, highlightHj?, highlightKeeps?, highlightCustomTracking?, highlightSubstitutedFonts?, richBlackOutput?, favoriteFonts?: [family], showFontNamesInEnglish?} → all application preferences",+ "{showHiddenCharacters?, typographersQuotes?, polygonSides?, starInset?, scaleStrokes?, dimensionsIncludeStroke?, transformationsAreTotals?, absolutePageNumbers?, highlightHj?, highlightKeeps?, highlightCustomTracking?, highlightSubstitutedFonts?, richBlackOutput?, favoriteFonts?: [family], showFontNamesInEnglish?, recoveryMinutes?, recentFilesMax?: 0–100} → all application preferences",super::always,|s, p| {let cur = serde_json::to_value(&s.prefs).map_err(|e| bad("prefs.set", e.to_string()))?;let new = merge("prefs.set", cur, p, None)?;- s.prefs = serde_json::from_value(new.clone()).map_err(|e| bad("prefs.set", e.to_string()))?;- Ok(new)+ s.prefs = serde_json::from_value(new).map_err(|e| bad("prefs.set", e.to_string()))?;+ s.prefs.trim_recent_files();+ serde_json::to_value(&s.prefs).map_err(|e| bad("prefs.set", e.to_string()))}),cmd!(diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rsindex caeeb80ba..05e10ebd1 100644--- a/crates/engine/src/lib.rs+++ b/crates/engine/src/lib.rs@@ -201,6 +201,31 @@ pub struct Prefs {pub show_note_anchors: bool,/// Preferences › File Handling: minutes between document recovery saves.pub recovery_minutes: f64,+ /// File › Open Recent: documents opened or saved, most recent first.+ pub recent_files: Vec<String>,+ /// Preferences › File Handling › Number of Recent Items to Display (0 keeps no list).+ pub recent_files_max: u32,+}++/// The most recent files Preferences lets File › Open Recent keep.+pub const MAX_RECENT_FILES: u32 = 100;++impl Prefs {+ /// Move `path` to the front of File › Open Recent (no duplicates, at most `recent_files_max`).+ pub fn note_recent_file(&mut self, path: &str) {+ if path.is_empty() {+ return;+ }+ self.recent_files.retain(|p| p != path);+ self.recent_files.insert(0, path.to_string());+ self.trim_recent_files();+ }++ /// Drop the entries beyond `recent_files_max` (capped at `MAX_RECENT_FILES`).+ pub fn trim_recent_files(&mut self) {+ self.recent_files_max = self.recent_files_max.min(MAX_RECENT_FILES);+ self.recent_files.truncate(self.recent_files_max as usize);+ }}/// A starter autocorrect list (common English typing slips).@@ -249,6 +274,8 @@ impl Default for Prefs {show_added_text: true,show_note_anchors: true,recovery_minutes: 0.5,+ recent_files: Vec::new(),+ recent_files_max: 20,}}}diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rsindex c2f1cb48e..3720821d4 100644--- a/crates/ui-egui/src/chrome.rs+++ b/crates/ui-egui/src/chrome.rs@@ -710,6 +710,7 @@ pub fn start_screen(app: &mut DesignApp, ui: &mut egui::Ui) {let _ = app.run("file.newSample", json!({}));}});+ recent_files(app, ui);ui.add_space(20.0);community_card(app, ui);ui.add_space(24.0);@@ -744,6 +745,38 @@ pub fn start_screen(app: &mut DesignApp, ui: &mut egui::Ui) {let _ = Content::Unassigned;}+/// Recent files shown on the start screen (File › Open Recent has them all).+const START_SCREEN_RECENT: usize = 8;++/// Start screen: the most recent files (name, then folder); a file that is gone is dimmed and says+/// so when clicked. Nothing when the list is empty.+fn recent_files(app: &mut DesignApp, ui: &mut egui::Ui) {+ if app.session.prefs.recent_files.is_empty() {+ return;+ }+ let t = Tokens::get(ui.ctx());+ ui.add_space(24.0);+ ui.label(crate::rtl::widget(+ ui,+ egui::RichText::new(crate::i18n::tr(&app.ui.language, "Recent files")).font(semibold(15.0)).color(t.text_strong),+ ));+ ui.add_space(6.0);+ let rows: Vec<(usize, String)> = app.session.prefs.recent_files.iter().take(START_SCREEN_RECENT).cloned().enumerate().collect();+ for (i, path) in rows {+ let p = std::path::Path::new(&path);+ let there = p.is_file();+ let folder = p.parent().map(|d| d.display().to_string()).unwrap_or_default();+ let mut job = egui::text::LayoutJob::default();+ let name_color = if there { t.text_strong } else { t.text_dim };+ job.append(&crate::menus::recent_label(&path), 0.0, egui::TextFormat { font_id: semibold(13.0), color: name_color, ..Default::default() });+ job.append(&folder, 10.0, egui::TextFormat { font_id: egui::FontId::proportional(12.0), color: t.text_dim, ..Default::default() });+ let r = ui.add(egui::Button::new(job).frame(false).min_size(vec2(0.0, 24.0))).on_hover_text(&path);+ if r.clicked() {+ let _ = app.run("app.openRecent", json!({"index": i}));+ }+ }+}+/// Start screen: the ArtCraft community (Discord first) and project links.fn community_card(app: &mut DesignApp, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rsindex 695a66af1..9df5f1a51 100644--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@ -828,6 +828,14 @@ fn preferences(app: &crate::DesignApp, ui: &mut egui::Ui, d: &mut Dialog, max_hed.fields.insert("recoveryMinutes".into(), json!(v));}});+ ui.add_space(6.0);+ ui.horizontal(|ui| {+ crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Number of Recent Items to Display:"));+ let mut v = d.n("recentFilesMax").unwrap_or(20.0);+ if ui.add(egui::DragValue::new(&mut v).range(0.0..=f64::from(designcraft_engine::MAX_RECENT_FILES)).speed(0.2)).changed() {+ d.fields.insert("recentFilesMax".into(), json!(v.round()));+ }+ });}"type" => {crate::rtl::label(ui, egui::RichText::new(crate::i18n::tr(&app.ui.language, "Type Options")).font(semibold(12.0)));@@ -1998,6 +2006,7 @@ pub fn confirm(app: &mut DesignApp) -> Result<Value, String> {json!({"scaleStrokes": d.b("scaleStrokes"), "dimensionsIncludeStroke": d.b("dimensionsIncludeStroke"), "transformationsAreTotals": d.b("transformationsAreTotals"), "absolutePageNumbers": d.b("absolutePageNumbers"), "highlightHj": d.b("highlightHj"), "highlightKeeps": d.b("highlightKeeps"), "highlightCustomTracking": d.b("highlightCustomTracking"), "highlightSubstitutedFonts": d.b("highlightSubstitutedFonts"), "richBlackOutput": d.b("richBlackOutput"), "typographersQuotes": d.b("typographersQuotes"), "showFontNamesInEnglish": d.b("showFontNamesInEnglish"), "smartTextReflow": d.b("smartTextReflow"),"autocorrect": d.b("autocorrect"), "showAddedText": d.b("showAddedText"), "showNoteAnchors": d.b("showNoteAnchors"),"recoveryMinutes": d.n("recoveryMinutes").unwrap_or(0.5),+ "recentFilesMax": d.n("recentFilesMax").unwrap_or(20.0).clamp(0.0, f64::from(designcraft_engine::MAX_RECENT_FILES)) as u32,"autocorrectList": d.s("autocorrectText").lines().filter_map(|l| {let (a, b) = l.split_once('→').or_else(|| l.split_once("->"))?;let (a, b) = (a.trim().to_lowercase(), b.trim().to_string());diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rsindex 5252c3881..7ea220604 100644--- a/crates/ui-egui/src/i18n.rs+++ b/crates/ui-egui/src/i18n.rs@@ -39,6 +39,29 @@ const TABLE: &[(&str, [&str; 5])] = &[("New", ["Neu", "Nouveau", "Nuevo", "新規", "新建"]),("New Document…", ["Neues Dokument …", "Nouveau document…", "Nuevo documento…", "新規ドキュメント…", "新建文档…"]),("Open…", ["Öffnen …", "Ouvrir…", "Abrir…", "開く…", "打开…"]),+ (+ "Open Recent",+ ["Zuletzt verwendete Datei öffnen", "Ouvrir les fichiers récents", "Abrir recientes", "最近使用したファイルを開く", "打开最近的文件"],+ ),+ (+ "Open Recent File",+ ["Zuletzt verwendete Datei öffnen", "Ouvrir un fichier récent", "Abrir archivo reciente", "最近使用したファイルを開く", "打开最近的文件"],+ ),+ (+ "Clear Recent Files",+ ["Liste leeren", "Effacer les fichiers récents", "Borrar archivos recientes", "最近使用したファイルをクリア", "清除最近的文件"],+ ),+ ("Recent files", ["Zuletzt geöffnet", "Fichiers récents", "Archivos recientes", "最近使用したファイル", "最近的文件"]),+ (+ "Number of Recent Items to Display:",+ [+ "Anzahl zuletzt verwendeter Dateien:",+ "Nombre de fichiers récents à afficher :",+ "Número de elementos recientes:",+ "最近使用したファイルの表示数:",+ "最近项目显示数量:",+ ],+ ),("Close", ["Schließen", "Fermer", "Cerrar", "閉じる", "关闭"]),("Save", ["Speichern", "Enregistrer", "Guardar", "保存", "保存"]),("Save As…", ["Speichern unter …", "Enregistrer sous…", "Guardar como…", "別名で保存…", "另存为…"]),diff --git a/crates/ui-egui/src/i18n/ar.rs b/crates/ui-egui/src/i18n/ar.rsindex a182d09ec..f4251a0aa 100644--- a/crates/ui-egui/src/i18n/ar.rs+++ b/crates/ui-egui/src/i18n/ar.rs@@ -965,6 +965,11 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Ruler Units", "وحدات المسطرة"),("Save Swatches for Exchange…", "حفظ عينات الألوان للتبادل…"),("Save recovery data every:", "حفظ بيانات الاسترداد كل:"),+ ("Open Recent", "فتح الملفات الأخيرة"),+ ("Open Recent File", "فتح ملف حديث"),+ ("Clear Recent Files", "مسح الملفات الأخيرة"),+ ("Recent files", "الملفات الأخيرة"),+ ("Number of Recent Items to Display:", "عدد العناصر الأخيرة المعروضة:"),("Saves which bars show and where the panels are.", "يحفظ الأشرطة الظاهرة ومواضع اللوحات."),("Search:", "البحث:"),(diff --git a/crates/ui-egui/src/i18n/it.rs b/crates/ui-egui/src/i18n/it.rsindex 75ece03f6..353a810a7 100644--- a/crates/ui-egui/src/i18n/it.rs+++ b/crates/ui-egui/src/i18n/it.rs@@ -300,6 +300,11 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Reverse", "Inverti"),("Save Swatches for Exchange…", "Salva campioni per lo scambio…"),("Save recovery data every:", "Salva dati di ripristino ogni:"),+ ("Open Recent", "Apri recenti"),+ ("Open Recent File", "Apri file recente"),+ ("Clear Recent Files", "Cancella file recenti"),+ ("Recent files", "File recenti"),+ ("Number of Recent Items to Display:", "Numero di elementi recenti da mostrare:"),("Search:", "Cerca:"),("Select an object.", "Seleziona un oggetto."),("Select text or a text frame.", "Seleziona del testo o una cornice di testo."),diff --git a/crates/ui-egui/src/i18n/ja.rs b/crates/ui-egui/src/i18n/ja.rsindex 642b4a4c0..11f810221 100644--- a/crates/ui-egui/src/i18n/ja.rs+++ b/crates/ui-egui/src/i18n/ja.rs@@ -302,6 +302,11 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Reverse", "反転"),("Save Swatches for Exchange…", "交換用スウォッチを保存…"),("Save recovery data every:", "復旧データの保存間隔:"),+ ("Open Recent", "最近使用したファイルを開く"),+ ("Open Recent File", "最近使用したファイルを開く"),+ ("Clear Recent Files", "最近使用したファイルをクリア"),+ ("Recent files", "最近使用したファイル"),+ ("Number of Recent Items to Display:", "最近使用したファイルの表示数:"),("Search:", "検索範囲:"),("Select an object.", "オブジェクトを選択してください。"),("Select text or a text frame.", "テキストまたはテキストフレームを選択してください。"),diff --git a/crates/ui-egui/src/i18n/pt_br.rs b/crates/ui-egui/src/i18n/pt_br.rsindex 982dfb20d..3c101fcb9 100644--- a/crates/ui-egui/src/i18n/pt_br.rs+++ b/crates/ui-egui/src/i18n/pt_br.rs@@ -973,6 +973,11 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Ruler Units", "Unidades da régua"),("Save Swatches for Exchange…", "Salvar amostras para intercâmbio…"),("Save recovery data every:", "Salvar dados de recuperação a cada:"),+ ("Open Recent", "Abrir recentes"),+ ("Open Recent File", "Abrir arquivo recente"),+ ("Clear Recent Files", "Limpar arquivos recentes"),+ ("Recent files", "Arquivos recentes"),+ ("Number of Recent Items to Display:", "Número de itens recentes a exibir:"),("Saves which bars show and where the panels are.", "Salva quais barras são exibidas e onde ficam os painéis."),("Search:", "Pesquisar:"),("Select an object to color its fill or stroke.", "Selecione um objeto para colorir seu preenchimento ou traçado."),diff --git a/crates/ui-egui/src/i18n/uk.rs b/crates/ui-egui/src/i18n/uk.rsindex f3bc8fb35..be930d799 100644--- a/crates/ui-egui/src/i18n/uk.rs+++ b/crates/ui-egui/src/i18n/uk.rs@@ -303,6 +303,11 @@ pub(super) const TABLE: &[(&str, &str)] = &[("Reverse", "Змінити напрямок"),("Save Swatches for Exchange…", "Зберегти зразки для обміну…"),("Save recovery data every:", "Зберігати дані відновлення через:"),+ ("Open Recent", "Відкрити нещодавні"),+ ("Open Recent File", "Відкрити нещодавній файл"),+ ("Clear Recent Files", "Очистити нещодавні файли"),+ ("Recent files", "Нещодавні файли"),+ ("Number of Recent Items to Display:", "Кількість нещодавніх елементів:"),("Search:", "Пошук:"),("Select an object.", "Виділіть об’єкт."),("Select text or a text frame.", "Виділіть текст або текстовий фрейм."),diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rsindex 872cb81d0..e617d59f3 100644--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@ -8,6 +8,7 @@ use crate::{DesignApp, ScreenMode};pub const UI_COMMANDS: &[(&str, &str, Option<&str>, &str)] = &[("app.newDocumentDialog", "New Document…", Some("Cmd+N"), "{}"),("app.openDialog", "Open…", Some("Cmd+O"), "{}"),+ ("app.openRecent", "Open Recent File", None, "{index} — file.openRecent, with an alert when the file can't be opened"),("app.placeDialog", "Place…", Some("Cmd+D"), "{}"),("app.saveDialog", "Save As…", Some("Cmd+Shift+S"), "{}"),("app.save", "Save", Some("Cmd+S"), "{}"),@@ -205,6 +206,9 @@ pub const MENUS: &[(&str, &[&str])] = &[&["ui:app.newDocumentDialog","ui:app.openDialog",+ ">Open Recent",+ "cmd:file.clearRecent",+ "<","-","cmd:file.close","ui:app.save",@@ -766,6 +770,16 @@ pub fn run_ui(app: &mut DesignApp, id: &str, p: &Value) -> Option<Result<Value,Ok(Value::Null)}"app.openDialog" => app.pick_and_open("open"),+ "app.openRecent" => {+ let index = p.get("index").cloned().unwrap_or(Value::Null);+ let name = index+ .as_u64()+ .and_then(|i| usize::try_from(i).ok())+ .and_then(|i| app.session.prefs.recent_files.get(i))+ .map(|path| recent_label(path))+ .unwrap_or_default();+ app.open_file("file.openRecent", json!({"index": index, "name": name}))+ }"app.placeDialog" => app.pick_and_open("place"),"app.placeWithOptions" => {// Word/RTF Import Options: style mapping and conflicts before the text lands.@@ -2084,6 +2098,9 @@ fn menu_items(app: &mut DesignApp, ui: &mut egui::Ui, items: &[Item], path: &strlet sub = format!("{path}/{name}");let shown = crate::i18n::tr(&app.ui.language, name).to_owned();menu_button(ui, crate::rtl::widget(ui, shown), |ui| {+ if sub == OPEN_RECENT {+ recent_menu_items(app, ui);+ }hidden += menu_items(app, ui, children, &sub);});}@@ -2109,6 +2126,55 @@ fn menu_items(app: &mut DesignApp, ui: &mut egui::Ui, items: &[Item], path: &strhidden}+/// The File › Open Recent submenu, whose files come before its fixed items.+pub const OPEN_RECENT: &str = "File/Open Recent";++/// A recent file's menu label: its file name.+pub fn recent_label(path: &str) -> String {+ std::path::Path::new(path).file_name().map_or_else(|| path.to_string(), |n| n.to_string_lossy().to_string())+}++/// File › Open Recent's files (`app.openRecent {index}`), then a separator; nothing when empty.+pub fn recent_items(app: &DesignApp) -> Vec<Item> {+ let mut out: Vec<Item> = app+ .session+ .prefs+ .recent_files+ .iter()+ .enumerate()+ .map(|(i, path)| Item::Cmd { label: recent_label(path), id: "app.openRecent".into(), params: json!({"index": i}), shortcut: None })+ .collect();+ if !out.is_empty() {+ out.push(Item::Sep);+ }+ out+}++/// The recent files at the top of File › Open Recent: file names (not translated), the full path+/// as tooltip, dimmed when the file is gone (choosing it then says so).+fn recent_menu_items(app: &mut DesignApp, ui: &mut egui::Ui) {+ let dim = crate::theme::Tokens::get(ui.ctx()).text_dim;+ for it in recent_items(app) {+ match it {+ Item::Cmd { label, id, params, .. } => {+ let path = params["index"].as_u64().and_then(|i| app.session.prefs.recent_files.get(i as usize)).cloned().unwrap_or_default();+ let mut text = egui::RichText::new(label);+ if !std::path::Path::new(&path).is_file() {+ text = text.color(dim);+ }+ if ui.button(crate::rtl::widget(ui, text)).on_hover_text(&path).clicked() {+ activate(app, &id, ¶ms);+ ui.close();+ }+ }+ Item::Sep => {+ ui.separator();+ }+ Item::Sub(..) => {}+ }+ }+}+/// Every menu item as (menu path, label), for Edit › Menus.pub fn all_menu_items() -> Vec<(String, String)> {fn walk(items: &[Item], path: &str, out: &mut Vec<(String, String)>) {@@ -3604,4 +3670,72 @@ mod tests {let (_, Some((_, _, open))) = frame(500.0, vec![]) else { panic!("test menu remains open") };assert!(!open, "an open submenu closes when its row becomes fully clipped");}++ fn start_screen_texts(app: &mut crate::DesignApp) -> Vec<String> {+ let ctx = egui::Context::default();+ crate::theme::install_fonts(&ctx, "");+ let mut shapes = Vec::new();+ for _ in 0..3 {+ let input =+ egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1400.0, 900.0))), ..Default::default() };+ let mut out = ctx.run_ui(input, |ui| {+ app.logic(&ui.ctx().clone());+ app.ui(ui);+ });+ out.textures_delta.clear();+ shapes = out.shapes;+ }+ shapes+ .iter()+ .filter_map(|s| match &s.shape {+ egui::Shape::Text(t) => Some(t.galley.text().to_string()),+ _ => None,+ })+ .collect()+ }++ /// File › Open Recent: the files first (`app.openRecent {index}`), then Clear Recent Files.+ #[test]+ fn open_recent_lists_the_files_then_clear() {+ let tree = menu_tree();+ let file = &tree.iter().find(|(m, _)| *m == "File").unwrap().1;+ let Some(Item::Sub(name, children)) = file.get(2) else { panic!("Open Recent after Open…: {:?}", file.get(2)) };+ assert_eq!(format!("File/{name}"), OPEN_RECENT);+ assert!(matches!(children.as_slice(), [Item::Cmd { id, .. }] if id == "file.clearRecent"));+ let mut app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ assert!(recent_items(&app).is_empty());+ assert!(!menu_enabled(&app, "file.clearRecent"));+ app.session.prefs.note_recent_file("/work/a.designcraft");+ app.session.prefs.note_recent_file("/work/b.idml");+ let items = recent_items(&app);+ let labels: Vec<_> = items+ .iter()+ .map(|i| match i {+ Item::Cmd { label, id, params, .. } => format!("{label} {id} {params}"),+ Item::Sep => "-".into(),+ Item::Sub(..) => "sub".into(),+ })+ .collect();+ assert_eq!(labels, ["b.idml app.openRecent {\"index\":0}", "a.designcraft app.openRecent {\"index\":1}", "-"]);+ assert!(menu_enabled(&app, "file.clearRecent"));+ assert!(menu_enabled(&app, "app.openRecent"));+ }++ /// A recent file that is gone says so in an alert (and the start screen still lists it).+ #[test]+ fn open_recent_of_a_missing_file_alerts_and_the_start_screen_lists_recent_files() {+ let mut app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ assert!(!start_screen_texts(&mut app).iter().any(|t| t == "Recent files"), "no section without recent files");+ app.session.prefs.note_recent_file("/nonexistent/dc-recent/gone.designcraft");+ assert!(app.run("app.openRecent", json!({"index": 0})).is_err());+ let d = app.ui.dialog.take().expect("an alert");+ assert_eq!(d.fields["title"], "Can't Open the File");+ assert_eq!(d.fields["file"], "gone.designcraft");+ assert!(d.fields["message"].as_str().unwrap().contains("can't be found"));+ assert!(app.run("app.openRecent", json!({"index": 9})).is_err(), "out of range: an error, not a panic");+ app.ui.dialog = None;+ let texts = start_screen_texts(&mut app);+ assert!(texts.iter().any(|t| t == "Recent files"), "{texts:?}");+ assert!(texts.iter().any(|t| t.starts_with("gone.designcraft")), "{texts:?}");+ }}diff --git a/docs/target-app-parity.md b/docs/target-app-parity.mdindex eb7d7e5c1..019b2510d 100644--- a/docs/target-app-parity.md+++ b/docs/target-app-parity.md@@ -1,6 +1,6 @@# DesignCraft parity with Adobe InDesign-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (cancelable macOS Dock Quit) · **Target:** Adobe InDesign 2026 (21.6.0.57, macOS)+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (File ▸ Open Recent) · **Target:** Adobe InDesign 2026 (21.6.0.57, macOS)The authoritative assessment of how close DesignCraft is to Adobe InDesign. [ROADMAP.md](../ROADMAP.md)summarizes it; [gaps.md](gaps.md) lists every known shortfall one at a time; the feature-by-feature@@ -220,7 +220,7 @@ table is the one summed.| Output & production | 92% | 55% | 40–70 | PDF/X-4 only (no X-1a/X-3), no PDF/print presets or `.joboptions`, print via craft-print (CUPS/Windows), no trapping; Output Preview panel || XML & automation | 100% | 35% | (ecosystem dimension) | no ExtendScript/UXP; XML structure depth || View & navigation | 100% | 65% | 10–20 | Navigator, display badges, Show/Hide extras (content grabber, live corners) |-| Undo, history, saving | 100% | 70% | 5–10 | Undo/Redo name the action; File ▸ Open Recent |+| Undo, history, saving | 100% | 70% | 5–10 | Undo/Redo name the action || Accessibility | 100% | 50% | 15–25 | tagged PDF exists; PDF/UA validation, reading order depth, screen-reader support in the UI |## Remaining effort and calibration