MCP: dialog params texts match the keys and fields ui.inspect lists

ui.inspect lists each open dialog with a key and its fields. The params
text of these commands, and docs/mcp.md, docs/control-protocol.md and
docs/target-app-parity.md, named keys and fields that ui.inspect does
not report:

- Recolor Artwork (ui.recolorDialog) and JavaScript Files
  (ui.javascriptFilesDialog) were listed with key null. Both dialogs now
  report the key their texts name: recolor and javascriptFiles.
- Print (file.print) and the print preset editor (ui.printPresetDialog):
  the texts said dialog print and printPreset; the key is null. The
  Print dialog lists section and sheet, not toFile, __section or
  __sheet, and Done is choice: done followed by ui.dialog.confirm, not
  discard: true. printer takes a name from print.printers, or PDF File,
  with which Print saves the job as a PDF.
- Find and Replace (ui.findAndReplace, ui.paramDialog with
  edit.findReplace): the texts said dialog findReplace and named an
  action field that ui.dialog.confirm runs. The key is null, the dialog
  lists no action field, and the texts now name its fields and buttons.
- Check Script (ui.checkScript): the texts said dialog scriptCheck with a
  report field. The key is null and the fields are lines, notes and
  groups; Copy copies the report as text.
- Import Shortcut Set (ui.shortcutImportDialog): the review opens inside
  Keyboard Shortcuts, which ui.inspect does not list. The text no longer
  names a shortcutImport dialog or its fields, and says that
  shortcutSet.read reads a file and matches its entries and
  importMatches.set stores matches.
- Data Recovery: the app asks about one copy at a time, with the field
  choice (recover or discard), not copies and discard.
- Reset Preferences: the question over Preferences is not listed in
  dialogs, and has no resetPreferences key.

Each command has a test that opens the dialog and checks its params text
against what ui.inspect lists.
This commit is contained in:
dotCooCoo committed 2026-11-29 18:59:21 -08:00
1 parent f4d422e470
commit ff81deb8d7
11 files changed
+179 -40

No files matched your search

+11 -6
View File
@@ -217,7 +217,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"ui.shortcutImportDialog",
"Import Shortcut Set…",
"",
"{path? | dataBase64?, name?} open Import Shortcut Set for a shortcut set another app saved as text (.kys; without a file, pick one): each entry matched to a tool, command or panel, and its key and modifier codes decoded (dialog `shortcutImport`: name, start: defaults|current, remember, rows: [{name, section, line, key, modifiers, target: entry id | \"\" (no equivalent) | null (not chosen), from, choices, on}], keys and mods: {code: {text, from, votes, names}}); Apply assigns the ready rows over Edit › Keyboard Shortcuts' working set, remembers the matches (importMatches.set) and shows Keyboard Shortcuts, whose OK keeps them. File › Open of a .kys opens it too",
"{path? | dataBase64?, name?} open Import Shortcut Set for a shortcut set another app saved as text (.kys; without a file, pick one): each entry matched to a tool, command or panel, and its key and modifier codes decoded. The review opens inside Edit › Keyboard Shortcuts, which ui.inspect does not list in `dialogs` and ui.dialog.set does not reach; with a file the reply is {entries, unread}. Without the window, shortcutSet.read reads a file and matches its entries, and importMatches.set stores matches. Apply assigns the ready rows over Edit › Keyboard Shortcuts' working set, remembers the matches (importMatches.set) and shows Keyboard Shortcuts, whose OK keeps them. File › Open of a .kys opens it too",
),
("view.outline", "Outline", "Cmd+Y", "{} toggle Outline/Preview"),
("view.pixelPreview", "Pixel Preview", "Cmd+Alt+Y", "{}"),
@@ -1006,7 +1006,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"ui.paramDialog",
"Command Dialog",
"",
"{command, label?, params} open a parameter dialog for any command. For commands other than edit.findReplace, params.__doc may be an unsigned document uid: the dialog previews and confirms only while that document is active, and OK after a document switch closes it without running the command. An invalid __doc is an error; omitting it keeps the existing behavior. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place (a null field gives none; a field of the wrong type is an error, and ui.dialog.confirm then runs no action), and Edit › Find Next goes on from it in the same document while the dialog is closed",
"{command, label?, params} open a parameter dialog for any command. For commands other than edit.findReplace, params.__doc may be an unsigned document uid: the dialog previews and confirms only while that document is active, and OK after a document switch closes it without running the command. An invalid __doc is an error; omitting it keeps the existing behavior. For edit.findReplace it opens Find and Replace (listed last in ui.inspect's `dialogs`, with key null), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers and lockedLayers (it also lists tab, more, goToKind, goToTarget and the read-only message), and the buttons Find Next (the next match, edit.findNext, shown in the dialog with its place among the matches), Replace (the match found, edit.replaceMatch), Replace & Find (both), Replace All (edit.findReplace) and Close. Replace and Replace & Find change a match that Find Next reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place (a null field gives none; a field of the wrong type is an error, and the dialog does not open), and Edit › Find Next goes on from it in the same document while the dialog is closed",
),
(
"ui.recolorDialog",
@@ -1979,7 +1979,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"file.print",
"Print…",
"Cmd+P",
"{} open the Print dialog (dialog `print`: the print.setup settings, preset (setting it loads that print preset; Save Preset… saves them as one), printer, toFile; Print keeps the settings with the document and prints, Done (discard: true) only keeps them); with params {preset? (a print preset's name: its settings instead of the document's), settings? (over the document's or the preset's), printer? (print.printers name; \"\" the default), toFile?, path?, format?: pdf|postscript, level?, flattenerPreset? (as engine file.print)} print without it: the print-ready PDF (engine file.print) goes to the printer → {pages, printer, printed: true, warnings}; with toFile, a path or no printing here (no print service) it is saved as a PDF at path (else a picked file, the web downloads it) → {path, pages, printed: false, warnings}; a PostScript file (format postscript, or a .ps path) is always saved that way",
"{} open the Print dialog (listed last in ui.inspect's `dialogs`, with key null; fields: the print.setup settings, `preset` (setting it loads that print preset; Save Preset… saves them as one), `printer` (a print.printers name, or PDF File, with which Print saves the job as a PDF), `section` and `sheet`; Print keeps the settings with the document and prints, Done (`choice`: done, then ui.dialog.confirm) only keeps them); with params {preset? (a print preset's name: its settings instead of the document's), settings? (over the document's or the preset's), printer? (print.printers name; \"\" the default), toFile?, path?, format?: pdf|postscript, level?, flattenerPreset? (as engine file.print)} print without it: the print-ready PDF (engine file.print) goes to the printer → {pages, printer, printed: true, warnings}; with toFile, a path or no printing here (no print service) it is saved as a PDF at path (else a picked file, the web downloads it) → {path, pages, printed: false, warnings}; a PostScript file (format postscript, or a .ps path) is always saved that way",
),
(
"print.printers",
@@ -1998,7 +1998,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"ui.printPresetDialog",
"Print Preset",
"",
"{name?: a saved preset to edit | preset?: the preset a new one starts from (default [Default])} open the preset editor (dialog `printPreset`: the Print dialog's settings fields plus `name`); OK runs print.presets.save and returns to Print Presets",
"{name?: a saved preset to edit | preset?: the preset a new one starts from (default [Default])} open the preset editor (listed last in ui.inspect's `dialogs`, with key null; fields: the Print dialog's settings fields plus `name`); OK runs print.presets.save and returns to Print Presets",
),
(
"plugin.dialog",
@@ -2082,7 +2082,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"ui.checkScript",
"Check Script…",
"",
"{path? | data? | dataBase64?, name?, includes?: true with a path} check a script written for the reference app without running it (script.check; with a path, the files its #include lines name are checked too) and show the report (dialog `scriptCheck`: `report`, script.check's result; Copy Report copies it as JSON); without a file pick one (the web opens the browser's file picker; File › Open of a .jsx, .jsxinc or .jsxbin file shows the report too)",
"{path? | data? | dataBase64?, name?, includes?: true with a path} check a script written for the reference app without running it (script.check; with a path, the files its #include lines name are checked too) and show the report (listed last in ui.inspect's `dialogs`, with key null; fields `lines`, `notes` and `groups`); with a file the reply is script.check's result, and the report's Copy button copies the report as text; without a file pick one (the web opens the browser's file picker; File › Open of a .jsx, .jsxinc or .jsxbin file shows the report too)",
),
(
"ui.perspectiveGridDialog",
@@ -2210,6 +2210,11 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"",
"{plane?: left|right|ground (default: the active plane)} open the plane's options, as double-clicking its plane widget does (dialog `perspectivePlane`: location (pt along the plane's normal), objects: none|move|copy): OK runs perspective.plane.move",
),
("ui.findAndReplace", "Find and Replace…", "", "{} open the Find and Replace dialog (Edit › Find and Replace…; dialog `findReplace`)"),
(
"ui.findAndReplace",
"Find and Replace…",
"",
"{} open the Find and Replace dialog (Edit › Find and Replace…; listed last in ui.inspect's `dialogs`, with key null; fields and buttons as ui.paramDialog with edit.findReplace)",
),
("ui.retype", "Retype", "", "{} open the Retype panel (Window › Retype) or start Retype"),
];
@@ -443,3 +443,28 @@ fn edit_find_next_starts_at_the_first_restored_match_with_that_frame_selected()
assert_eq!(selected(&p), vec![first]);
assert_eq!(undo_steps(&p), before);
}
/// `ui.findAndReplace` and `ui.paramDialog` with edit.findReplace open the dialog that `ui.inspect` lists with key null
/// and the fields the params text names, as both params texts say.
#[test]
fn params_texts_match_what_ui_inspect_lists() {
const FIELDS: [&str; 7] = ["find", "replace", "matchCase", "wholeWord", "backwards", "hiddenLayers", "lockedLayers"];
let doc = |command: &str| crate::menus::UI_COMMANDS.iter().find(|c| c.0 == command).expect("registered").3;
for (command, params) in [("ui.findAndReplace", json!({})), ("ui.paramDialog", json!({"command": super::COMMAND, "params": {}}))] {
let mut app = crate::testing::windowed(app_with(&["alpha"]).0);
app.run(command, params).unwrap();
let ctx = app.ui_ctx.clone().unwrap();
let ui = crate::control::inspect(&app, &ctx);
let entry = ui["dialogs"].as_array().and_then(|d| d.last()).cloned().expect("a dialog");
assert!(entry["key"].is_null(), "{command}: {entry}");
assert!(doc(command).contains("with key null"), "{command} opens a dialog with key null, which its params text does not say");
for field in FIELDS {
assert!(entry["fields"].get(field).is_some(), "{command}: ui.inspect does not list `{field}`");
}
}
let named = doc("ui.paramDialog");
for field in FIELDS {
assert!(named.contains(field), "the params text of ui.paramDialog does not name `{field}`");
}
assert!(!named.contains("and action"), "the params text of ui.paramDialog names an `action` field that ui.inspect does not list");
}
@@ -111,6 +111,10 @@ impl StackDialog for JavaScriptFiles {
dialog_id(KEY)
}
fn key(&self) -> Option<&str> {
Some(KEY)
}
fn show(&mut self, ui: &mut Ui, _: &DialogStack) -> Option<DialogResult<()>> {
let Self { open, files, form } = self;
let shown = Dialog::new(tl!("JavaScript Files"))
@@ -418,4 +422,19 @@ mod tests {
fixture.click(&add);
assert_eq!(form.borrow().pending, Some(Pending::Add));
}
/// `ui.javascriptFilesDialog` opens the dialog whose `key` its params text names, as `ui.inspect` lists it.
#[test]
fn params_text_names_the_dialog_key_ui_inspect_lists() {
const COMMAND: &str = "ui.javascriptFilesDialog";
let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == COMMAND).expect("registered").3;
let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Default::default()));
app.run("file.new", json!({"width": 100, "height": 100})).unwrap();
app.run(COMMAND, json!({})).unwrap();
let ctx = app.ui_ctx.clone().unwrap();
let ui = crate::control::inspect(&app, &ctx);
let key = ui["dialogs"].as_array().and_then(|d| d.last()).and_then(|d| d["key"].as_str()).expect("a dialog with a key");
assert_eq!(key, KEY);
assert!(doc.contains(&format!("dialog `{key}`")), "{COMMAND} opens `{key}`, which its params text does not name");
}
}
+21
View File
@@ -1993,6 +1993,10 @@ impl StackDialog for RecolorDialog {
self.id
}
fn key(&self) -> Option<&str> {
Some(KIND)
}
fn show(&mut self, ui: &mut Ui, _: &DialogStack) -> Option<DialogResult<Fields>> {
self.shown(ui)
}
@@ -5634,4 +5638,21 @@ mod tests {
rc.settled();
assert!(rc.by_label(tl!("Color Groups")).is_none(), "and hides with `groupStorage`");
}
/// `ui.recolorDialog` opens the dialog whose `key` its params text names, as `ui.inspect` lists it.
#[test]
fn params_text_names_the_dialog_key_ui_inspect_lists() {
const COMMAND: &str = "ui.recolorDialog";
let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == COMMAND).expect("registered").3;
let mut app = app(120);
let red = square(&mut app, 10.0, "#ff0000");
app.run("select.set", json!({"ids": [red]})).unwrap();
let rc = opened(app, json!({}));
let app = rc.app();
let ctx = app.ui_ctx.clone().unwrap();
let ui = crate::control::inspect(&app, &ctx);
let key = ui["dialogs"].as_array().and_then(|d| d.last()).and_then(|d| d["key"].as_str()).expect("a dialog with a key");
assert_eq!(key, KIND);
assert!(doc.contains(&format!("dialog `{key}`")), "{COMMAND} opens `{key}`, which its params text does not name");
}
}
+30
View File
@@ -620,3 +620,33 @@ fn every_number_and_length_field_is_named() {
}
}
}
/// Opens the dialog of `command` and checks its params text against the last dialog `ui.inspect` lists: the text says
/// the dialog's key is null, and names `fields`, each of which the dialog lists.
fn assert_params_text_matches_ui_inspect(command: &str, fields: &[&str]) {
let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == command).expect("registered").3;
let (mut app, _) = app();
app.run(command, json!({})).unwrap();
pump(&mut app);
let ui = crate::control::inspect(&app, &ctx(&app));
let entry = ui["dialogs"].as_array().and_then(|d| d.last()).cloned().expect("a dialog");
assert!(entry["key"].is_null(), "{command}: {entry}");
assert!(doc.contains("with key null"), "{command} opens a dialog with key null, which its params text does not say");
for field in fields {
assert!(entry["fields"].get(field).is_some(), "{command}: ui.inspect does not list `{field}`");
assert!(doc.contains(&format!("`{field}`")), "{command}: its params text does not name `{field}`");
}
}
/// `file.print` opens the Print dialog, which `ui.inspect` lists with key null and the fields its params text names.
#[test]
fn print_params_text_matches_what_ui_inspect_lists() {
assert_params_text_matches_ui_inspect("file.print", &["preset", "printer", "section", "sheet"]);
}
/// `ui.printPresetDialog` opens the preset editor, which `ui.inspect` lists with key null and the fields its params
/// text names.
#[test]
fn preset_editor_params_text_matches_what_ui_inspect_lists() {
assert_params_text_matches_ui_inspect("ui.printPresetDialog", &["name"]);
}
@@ -263,3 +263,20 @@ fn an_imported_shortcut_reaches_a_filter_plugin_picked_as_its_target() {
vectorcraft_plugins::registry::remove(id);
assert!(shortcut_editor::entries().iter().all(|e| e.key != key), "a removed filter is no target");
}
/// `ui.shortcutImportDialog` shows its review inside Keyboard Shortcuts, which `ui.inspect` does not list in `dialogs`,
/// so its params text names no dialog key.
#[test]
fn params_text_names_no_dialog_key_for_the_review() {
const COMMAND: &str = "ui.shortcutImportDialog";
let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == COMMAND).expect("registered").3;
let mut app = crate::testing::windowed(app());
let b64 = vectorcraft_format::base64_encode(SET.as_bytes());
let r = app.run(COMMAND, json!({"dataBase64": b64, "name": "Sent.kys"})).unwrap();
assert!(r["entries"].is_u64() && r["unread"].is_u64(), "{r}");
assert!(app.shortcuts_dialog.as_ref().is_some_and(|d| d.pending_review.is_some()), "the review waits in Keyboard Shortcuts");
let ctx = app.ui_ctx.clone().unwrap();
let ui = crate::control::inspect(&app, &ctx);
assert_eq!(ui["dialogs"], json!([]), "{COMMAND} opens no dialog that ui.inspect lists");
assert!(!doc.contains("dialog `"), "the params text of {COMMAND} names a dialog key that ui.inspect does not list");
}
+11 -6
View File
@@ -218,7 +218,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"ui.shortcutImportDialog",
"Import Shortcut Set…",
"",
"{path? | dataBase64?, name?} open Import Shortcut Set for a shortcut set another app saved as text (.kys; without a file, pick one): each entry matched to a tool, command or panel, and its key and modifier codes decoded (dialog `shortcutImport`: name, start: defaults|current, remember, rows: [{name, section, line, key, modifiers, target: entry id | \"\" (no equivalent) | null (not chosen), from, choices, on}], keys and mods: {code: {text, from, votes, names}}); Apply assigns the ready rows over Edit › Keyboard Shortcuts' working set, remembers the matches (importMatches.set) and shows Keyboard Shortcuts, whose OK keeps them. File › Open of a .kys opens it too",
"{path? | dataBase64?, name?} open Import Shortcut Set for a shortcut set another app saved as text (.kys; without a file, pick one): each entry matched to a tool, command or panel, and its key and modifier codes decoded. The review opens inside Edit › Keyboard Shortcuts, which ui.inspect does not list in `dialogs` and ui.dialog.set does not reach; with a file the reply is {entries, unread}. Without the window, shortcutSet.read reads a file and matches its entries, and importMatches.set stores matches. Apply assigns the ready rows over Edit › Keyboard Shortcuts' working set, remembers the matches (importMatches.set) and shows Keyboard Shortcuts, whose OK keeps them. File › Open of a .kys opens it too",
),
("view.outline", "Outline", "Cmd+Y", "{} toggle Outline/Preview"),
("view.pixelPreview", "Pixel Preview", "Cmd+Alt+Y", "{}"),
@@ -1007,7 +1007,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"ui.paramDialog",
"Command Dialog",
"",
"{command, label?, params} open a parameter dialog for any command. For commands other than edit.findReplace, params.__doc may be an unsigned document uid: the dialog previews and confirms only while that document is active, and OK after a document switch closes it without running the command. An invalid __doc is an error; omitting it keeps the existing behavior. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place (a null field gives none; a field of the wrong type is an error, and ui.dialog.confirm then runs no action), and Edit › Find Next goes on from it in the same document while the dialog is closed",
"{command, label?, params} open a parameter dialog for any command. For commands other than edit.findReplace, params.__doc may be an unsigned document uid: the dialog previews and confirms only while that document is active, and OK after a document switch closes it without running the command. An invalid __doc is an error; omitting it keeps the existing behavior. For edit.findReplace it opens Find and Replace (listed last in ui.inspect's `dialogs`, with key null), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers and lockedLayers (it also lists tab, more, goToKind, goToTarget and the read-only message), and the buttons Find Next (the next match, edit.findNext, shown in the dialog with its place among the matches), Replace (the match found, edit.replaceMatch), Replace & Find (both), Replace All (edit.findReplace) and Close. Replace and Replace & Find change a match that Find Next reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place (a null field gives none; a field of the wrong type is an error, and the dialog does not open), and Edit › Find Next goes on from it in the same document while the dialog is closed",
),
(
"ui.recolorDialog",
@@ -1980,7 +1980,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"file.print",
"Print…",
"Cmd+P",
"{} open the Print dialog (dialog `print`: the print.setup settings, preset (setting it loads that print preset; Save Preset… saves them as one), printer, toFile; Print keeps the settings with the document and prints, Done (discard: true) only keeps them); with params {preset? (a print preset's name: its settings instead of the document's), settings? (over the document's or the preset's), printer? (print.printers name; \"\" the default), toFile?, path?, format?: pdf|postscript, level?, flattenerPreset? (as engine file.print)} print without it: the print-ready PDF (engine file.print) goes to the printer → {pages, printer, printed: true, warnings}; with toFile, a path or no printing here (no print service) it is saved as a PDF at path (else a picked file, the web downloads it) → {path, pages, printed: false, warnings}; a PostScript file (format postscript, or a .ps path) is always saved that way",
"{} open the Print dialog (listed last in ui.inspect's `dialogs`, with key null; fields: the print.setup settings, `preset` (setting it loads that print preset; Save Preset… saves them as one), `printer` (a print.printers name, or PDF File, with which Print saves the job as a PDF), `section` and `sheet`; Print keeps the settings with the document and prints, Done (`choice`: done, then ui.dialog.confirm) only keeps them); with params {preset? (a print preset's name: its settings instead of the document's), settings? (over the document's or the preset's), printer? (print.printers name; \"\" the default), toFile?, path?, format?: pdf|postscript, level?, flattenerPreset? (as engine file.print)} print without it: the print-ready PDF (engine file.print) goes to the printer → {pages, printer, printed: true, warnings}; with toFile, a path or no printing here (no print service) it is saved as a PDF at path (else a picked file, the web downloads it) → {path, pages, printed: false, warnings}; a PostScript file (format postscript, or a .ps path) is always saved that way",
),
(
"print.printers",
@@ -1999,7 +1999,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"ui.printPresetDialog",
"Print Preset",
"",
"{name?: a saved preset to edit | preset?: the preset a new one starts from (default [Default])} open the preset editor (dialog `printPreset`: the Print dialog's settings fields plus `name`); OK runs print.presets.save and returns to Print Presets",
"{name?: a saved preset to edit | preset?: the preset a new one starts from (default [Default])} open the preset editor (listed last in ui.inspect's `dialogs`, with key null; fields: the Print dialog's settings fields plus `name`); OK runs print.presets.save and returns to Print Presets",
),
(
"plugin.dialog",
@@ -2083,7 +2083,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"ui.checkScript",
"Check Script…",
"",
"{path? | data? | dataBase64?, name?, includes?: true with a path} check a script written for the reference app without running it (script.check; with a path, the files its #include lines name are checked too) and show the report (dialog `scriptCheck`: `report`, script.check's result; Copy Report copies it as JSON); without a file pick one (the web opens the browser's file picker; File › Open of a .jsx, .jsxinc or .jsxbin file shows the report too)",
"{path? | data? | dataBase64?, name?, includes?: true with a path} check a script written for the reference app without running it (script.check; with a path, the files its #include lines name are checked too) and show the report (listed last in ui.inspect's `dialogs`, with key null; fields `lines`, `notes` and `groups`); with a file the reply is script.check's result, and the report's Copy button copies the report as text; without a file pick one (the web opens the browser's file picker; File › Open of a .jsx, .jsxinc or .jsxbin file shows the report too)",
),
(
"ui.perspectiveGridDialog",
@@ -2211,6 +2211,11 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"",
"{plane?: left|right|ground (default: the active plane)} open the plane's options, as double-clicking its plane widget does (dialog `perspectivePlane`: location (pt along the plane's normal), objects: none|move|copy): OK runs perspective.plane.move",
),
("ui.findAndReplace", "Find and Replace…", "", "{} open the Find and Replace dialog (Edit › Find and Replace…; dialog `findReplace`)"),
(
"ui.findAndReplace",
"Find and Replace…",
"",
"{} open the Find and Replace dialog (Edit › Find and Replace…; listed last in ui.inspect's `dialogs`, with key null; fields and buttons as ui.paramDialog with edit.findReplace)",
),
("ui.retype", "Retype", "", "{} open the Retype panel (Window › Retype) or start Retype"),
];
+18
View File
@@ -222,3 +222,21 @@ fn every_id_a_report_holds_has_a_label() {
assert!(problem_label(code).is_some(), "{code}");
}
}
/// `ui.checkScript` with a script opens the report that `ui.inspect` lists with key null and the fields its params text
/// names.
#[test]
fn params_text_matches_what_ui_inspect_lists() {
const COMMAND: &str = "ui.checkScript";
let doc = menus::UI_COMMANDS.iter().find(|c| c.0 == COMMAND).expect("registered").3;
let mut app = app();
menus::run_ui_command(&mut app, COMMAND, &json!({"data": "var a = 1;", "name": "Clean.jsx"})).unwrap().unwrap();
let ui = crate::control::inspect(&app, &window(&app));
let entry = ui["dialogs"].as_array().and_then(|d| d.last()).cloned().expect("a dialog");
assert!(entry["key"].is_null(), "{COMMAND}: {entry}");
assert!(doc.contains("with key null"), "{COMMAND} opens a dialog with key null, which its params text does not say");
for field in ["lines", "notes", "groups"] {
assert!(entry["fields"].get(field).is_some(), "{COMMAND}: ui.inspect does not list `{field}`");
assert!(doc.contains(&format!("`{field}`")), "{COMMAND}: its params text does not name `{field}`");
}
}
+16 -16
View File
@@ -939,11 +939,11 @@ with `overprints: "preserve"`. Its `ui.dialog.confirm` sets every option as `fla
in the dropdown or with `ui.dialog.set {flattenerPreset}`, drops `flattener`, and so does `ui.epsOptionsDialog` with
a `flattenerPreset` and no `flattener`.
Data Recovery: at launch, copies left behind by a crash open the `recovery` dialog (never copies another running
instance keeps, so instances started side by side for screenshots don't get it). Fields: `copies` (`[{file, title,
saved}]`, from `file.recovery.list`) and `discard`. `ui.dialog.confirm` restores them all (`file.recovery.restore`
each, opening "<name> [Recovered]" documents), `discard: true` then confirm deletes them, `ui.dialog.cancel` keeps them
for the next launch. While copies are written in the background `ui.inspect` lists them under `background`
Data Recovery: at launch, the app asks about each copy left behind by a crash in turn (never copies another running
instance keeps, so instances started side by side for screenshots don't get it). `ui.inspect` lists each question in
`dialogs` with key null and one field, `choice`: `recover` (the default) or `discard`. `ui.dialog.confirm` answers for that copy: `recover` restores it (`file.recovery.restore`, opening a
"<name> [Recovered]" document) and `discard` deletes it (`file.recovery.discard`); the next copy is then asked about.
`ui.dialog.cancel` keeps that copy and every later one for the next launch. While copies are written in the background `ui.inspect` lists them under `background`
("Saving recovery data for <name>"). After a restore the status bar shows the count followed by the first of the
restored documents' notes: each document's lines about its linked files, then its warnings (what reading the copy left
out first), named with the document's title when more than one was restored. Hovering the message lists them all. The
@@ -1010,15 +1010,15 @@ document starts on `cmyk`), `layers` (true: Write Layers; false: Flat Image, who
`preserveText`, `maxEditability` and `hiddenLayers` (with layers) and `embedIcc`. `ui.dialog.set` the fields and
`ui.dialog.confirm` writes the file(s) with `document.export`; with Flat Image it leaves `preserveText` out.
Print: File → Print… (`file.print` with no params, Ctrl/Cmd+P) opens the `print` dialog on the document's print
settings. Its fields are the `print.setup` settings (`copies`, `artboards`, `range`, `media`, `orientation`,
`placement`, `scaling`, `marks`, `bleed`, `output`, `graphics`, `color`, `margin`…; a section is an object, as
`{field: "marks", value: {"trim": true}}`) plus `printer` (a name from `print.printers`, `""` the system's default) and
`toFile` (save the job as a PDF), and the UI-only `__section` (General, Marks and Bleed, Output, Graphics, Color
Management, Advanced, Summary) and `__sheet` (the page the preview shows, 0-based). `ui.dialog.confirm` (Print) keeps
the settings with the document (`print.setup`, one undo step) and prints them: to the printer through the system's
print queue (the web: the browser's print dialog), else, with `toFile` or no printing available, a save panel for the
PDF. With `discard: true` it is Done: it only keeps the settings. Settings that can't print (a missing artboard, a
Print: File → Print… (`file.print` with no params, Ctrl/Cmd+P) opens the Print dialog on the document's print
settings. `ui.inspect` lists it last in `dialogs`, with key null. Its fields are the `print.setup` settings (`copies`,
`artboards`, `range`, `media`, `orientation`, `placement`, `scaling`, `marks`, `bleed`, `output`, `graphics`,
`color`, `margin`…; a section is an object, as `{field: "marks", value: {"trim": true}}`) plus `printer` (a name from
`print.printers`, or `PDF File`, with which Print saves the job as a PDF), and the UI-only `section` (General, Marks and Bleed, Output, Graphics, Color Management, Advanced,
Summary) and `sheet` (the page the preview shows, 0-based). `ui.dialog.confirm` (Print) keeps the settings with the
document (`print.setup`, one undo step) and prints them: to the printer through the system's print queue (the web:
the browser's print dialog), else, with `PDF File` or no printing available, a save panel for the PDF. After
`ui.dialog.set {field: "choice", value: "done"}`, `ui.dialog.confirm` is Done: it only keeps the settings. Settings that can't print (a missing artboard, a
range of no tiles) answer with an error and keep the dialog open. `file.print {settings?, printer?, toFile?, path?}`
prints without the dialog; `print.printers` lists the printers and `print.printerSetup {printer?}` opens their system
settings (Setup…). Desktop submission returns `{background: true, printed: false, printer, status}`
@@ -1033,13 +1033,13 @@ reply `{ok: false, error: "…"}`; later spooler failures appear in `ui.inspect`
no second reply or structured backend error object. Headless MCP keeps its engine-only `file.print`
result (`path` or `dataBase64`, plus the same print metadata); no spooler fields are added there.
Print presets: in the `print` dialog, `preset` names the print preset whose settings were loaded last; setting it
Print presets: in the Print dialog, `preset` names the print preset whose settings were loaded last; setting it
(`ui.dialog.set {field: "preset", value: "Posters"}`) loads that preset's settings, and the list reads `[Custom]` once
they differ. Save Preset… shows a name field (`__savePresetAs`): while it shows, `ui.dialog.confirm` saves the dialog's
settings as that preset (`print.presets.save`) and selects it instead of printing. `ui.printPresetsDialog {selected?}`
opens Edit → Print Presets (dialog `printPresets`, field `selected`); `[Default]` is protected. New… and Edit… open the
preset editor, which `ui.printPresetDialog {name? (a saved preset to edit) | preset? (the preset a new one starts
from)}` opens too: dialog `printPreset`, the Print dialog's settings fields plus `name`; `ui.dialog.confirm` runs
from)}` opens too, listed last in `dialogs` with key null: the Print dialog's settings fields plus `name`; `ui.dialog.confirm` runs
`print.presets.save` and returns to Print Presets (a new preset can't take a name in use). Delete, Import… and
Export… are `print.presets.delete`, `print.presets.import` and `print.presets.export`; `ui.dialog.confirm` closes.
Opening a `.vcprintpresets` file with `app.open` imports its presets.
+10 -11
View File
@@ -10430,8 +10430,8 @@ settings whose label, section or category contains it, ignoring case, in the int
"No settings found". Choosing a setting sets `__category` to its category, sets `__found` to its key (the row is
highlighted until another category is shown) and clears `__search`. Cmd/Ctrl+F focuses the field again; Escape in the
field with text clears it, and Escape in the empty field closes the dialog. Its Reset Preferences button opens a
`resetPreferences` question (fields `message`, `detail`) over Preferences: `ui.dialog.cancel` shows Preferences again
as it was, and `ui.dialog.confirm` shows it again with every preference at its default value, applied by OK in
question over Preferences, which `ui.inspect` does not list in `dialogs`. While it shows, `ui.dialog.cancel` on
Preferences answers it and shows Preferences again as it was, and `ui.dialog.confirm` shows it again with every preference at its default value, applied by OK in
Preferences. `prefs.reset` resets the preferences at once, without the question. OK in Preferences writes only the
fields changed in the dialog since it opened or since its last Apply, so a preference, Smart Guides, Snap to Grid,
Enable Contextual Task Bar or the document's units changed some other way while it is open (a command, a panel menu,
@@ -13661,19 +13661,18 @@ nothing changes, no undo step is recorded. An empty `find` is an error in all th
{"name":"run_command","arguments":{"command":"edit.findNext","params":{"find":"colour","wholeWord":true,"from":{"id":12,"start":4,"end":9}}}}
```
In the app, Edit › Find and Replace… opens a dialog that stays open (kind `findReplace`), with Find and Replace With
fields, Match Case, Find Whole Word, Search Backwards, Check Hidden Layers and Check Locked Layers, and Find, Replace,
Replace & Find, Replace All and Done. Its fields are `find`, `replace`, `matchCase`, `wholeWord`, `backwards`,
`hiddenLayers`, `lockedLayers` and `action`; `ui.dialog.confirm` runs the `action`: `find` (the default), `replace`,
`replaceFind`, `replaceAll` or `done`, which closes the dialog. The dialog shows the match found in its line of text
with its place among the matches. Replace and Replace & Find change a match that Find reached with the Find text and
the options as they are now, and find one otherwise. Enter runs Find. Edit › Find Next goes on from the dialog's last
In the app, Edit › Find and Replace… opens a dialog that stays open, with Find and Replace With fields, Match Case,
Find Whole Word, Search Backwards, Check Hidden Layers and Check Locked Layers, and Find Next, Replace, Replace & Find,
Replace All and Close. `ui.inspect` lists it last in `dialogs`, with key null. Its fields are `find`, `replace`,
`matchCase`, `wholeWord`, `backwards`, `hiddenLayers` and `lockedLayers`, and it also lists `tab`, `more`,
`goToKind`, `goToTarget` and the read-only `message`. The dialog shows the match found in its line of text
with its place among the matches. Replace and Replace & Find change a match that Find Next reached with the Find text
and the options as they are now, and find one otherwise. Enter runs Find Next. Edit › Find Next goes on from the dialog's last
search while the dialog is closed, and opens the dialog when there has been none. A place the search reached in one
document is not used in another, nor once the Find text or an option that decides a match changes: the search then
starts again as it does without `from`. `ui.paramDialog` opens
the dialog on the last search, with the fields its `params` give in its place. A null field gives none, and a field of
the wrong type is an error that leaves the dialog closed. Once it is open, `ui.dialog.confirm` with a field of the
wrong type runs no action and returns the error.
the wrong type is an error that leaves the dialog closed.
For other command dialogs, `params.__doc` can supply a document uid. The dialog previews and confirms only while
that document is active. Confirming after a document switch closes the dialog without running its command.
+1 -1
View File
@@ -967,7 +967,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Export and Import Preferences (#6435):** an optional VectorCraft feature. The Preferences dialog's Export Preferences… saves the applied preferences to a JSON file (`prefs.export`; the web build downloads it), and Import Preferences… applies such a file (`prefs.import`). The file leaves out the folder preferences. The import checks every value first and changes nothing on an error; it keeps the open document's units and records no undo step. The file format is VectorCraft's own. Tests: `crates/engine/src/tests/prefs_file.rs`, `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Preferences › User Interface › Open Documents As Tabs (G7, #394):** checked by default, documents open under tabs in one document window ([public source](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/workspace-overview.html)). With the box cleared, each document opened or created afterwards opens in a floating window of its own, at the next cascade place, as Float in Window floats it; documents already open stay where they are, and checking the box again leaves floating documents in their windows. Tests: `crates/ui-egui/src/doc_windows/tests.rs`.
- **Preferences search:** a Search Preferences field above the category list has the keyboard focus when the dialog opens, and Cmd/Ctrl+F gives it back; typing lists the settings it finds, and choosing one shows its category, as the [help page](https://helpx.adobe.com/illustrator/desktop/get-started/preferences-and-settings/set-app-preferences.html) describes. VectorCraft's own rules: the field matches a setting's label, section or category, ignoring case, in the interface language or in English; the list replaces the categories while the field has text and shows every match, or "No settings found"; the chosen setting's row is highlighted and scrolled into view; Escape in the field with text clears it, and Escape in the empty field closes the dialog. The dialog's `__search` field (`ui.dialog.set`) holds the text. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Reset Preferences asks first (#6435):** the Preferences dialog's Reset Preferences button opens a question over the dialog (`resetPreferences`). Cancel or Escape goes back to Preferences unchanged, with its category, search and edits kept; OK goes back with every preference at its default value, which OK in Preferences applies and Cancel there discards. The question and its wording are VectorCraft's own. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Reset Preferences asks first (#6435):** the Preferences dialog's Reset Preferences button opens a question over the dialog, which `ui.inspect` does not list in `dialogs`. Cancel or Escape goes back to Preferences unchanged, with its category, search and edits kept; OK goes back with every preference at its default value, which OK in Preferences applies and Cancel there discards. The question and its wording are VectorCraft's own. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Reset Preferences resets every setting the dialog shows:** Smart Guides and Snap to Grid also return to their defaults (on and off) when Reset Preferences is confirmed, and General's Enable Contextual Task Bar takes the value the current workspace was saved with. OK in Preferences applies them with the other defaults, and Cancel keeps the values in use. A category's own reset resets the row of that category, and File Handling's also resets the app chosen for Edit Original. `prefs.reset` (the Command Palette's Reset Preferences) resets them too, each only when it resets every category or the setting's own, and with every category or File Handling it also clears the app chosen for Edit Original. The rule is VectorCraft's own. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`, `crates/ui-egui/src/original_editor.rs`.
- **Preferences OK keeps changes made outside the dialog:** OK preserves command or script changes to fields left unchanged in the dialog, including preferences, Smart Guides, Snap to Grid, Enable Contextual Task Bar and document units. A field edited in both places takes the dialog's value. OK saves an opening-time Hold Shortcut Delay correction unless a later command changed that value. An external reset preserves dialog edits, and Apply refreshes the baseline from current preferences and UI values. A workspace switched to while the dialog is open keeps its own Contextual Task Bar. With no field change or delay correction, OK writes nothing. The rule is VectorCraft's own. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Preferences › General describes its settings:** the line under the Preferences fields shows a sentence for each of the 32 General settings, Enable Contextual Task Bar included, when the pointer is over the setting's row or its control has the keyboard focus, and a screen reader gets the same sentence. The sentences are VectorCraft's own and state what the app does with each setting. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.