ui: File › New starts an empty model (file.new, #144); an unknown sample name opens the samples (#200)

file.new replaces the session with an empty one: no design, mesh, definitions, results or
journal, nothing to save, the undo history empty. The File menu and Cmd/Ctrl+N run it, asking
first over unsaved changes. A sample name the app does not know (a typo, an old ?sample= link)
opens the samples to choose from, and the status names it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-15 11:07:46 -04:00
1 parent 92b6225a72
commit 0625125ed7
7 files changed
+81 -5

No files matched your search

+5 -2
View File
@@ -1758,12 +1758,13 @@ impl ModelApp {
let shortcut = |modifiers, key| egui::KeyboardShortcut::new(modifiers, key);
let shift = egui::Modifiers::COMMAND | egui::Modifiers::SHIFT;
// Shift first: the plain shortcut matches it too.
let (redo, undo, save_as, save, open) = ctx.input_mut(|i| {
let (redo, undo, save_as, save, open, new) = ctx.input_mut(|i| {
let redo = i.consume_shortcut(&shortcut(shift, egui::Key::Z)) || i.consume_shortcut(&shortcut(egui::Modifiers::COMMAND, egui::Key::Y));
let undo = i.consume_shortcut(&shortcut(egui::Modifiers::COMMAND, egui::Key::Z));
let save_as = i.consume_shortcut(&shortcut(shift, egui::Key::S));
let save = i.consume_shortcut(&shortcut(egui::Modifiers::COMMAND, egui::Key::S));
(redo, undo, save_as, save, i.consume_shortcut(&shortcut(egui::Modifiers::COMMAND, egui::Key::O)))
let open = i.consume_shortcut(&shortcut(egui::Modifiers::COMMAND, egui::Key::O));
(redo, undo, save_as, save, open, i.consume_shortcut(&shortcut(egui::Modifiers::COMMAND, egui::Key::N)))
});
if redo {
let _ = self.run("edit.redo", json!({}));
@@ -1777,6 +1778,8 @@ impl ModelApp {
}
if open {
self.open_dialog(None);
} else if new {
self.new_model();
}
// Delete (or Backspace) deletes the definition selected in the browser, after asking.
if self.prompt.is_none()