From 80bbcb98bad088a19337ff5ca71d7d28d2003d6b Mon Sep 17 00:00:00 2001 From: Sladrian Pedroso <294190500+Sladrian@users.noreply.github.com> Date: Tue, 20 Oct 2026 14:58:37 -0300 Subject: [PATCH 1/4] A quick right-click is Enter between commands too: it runs the typed command or repeats the last one (fixes #1387) With the time-sensitive right-click on (the default), a quick right-click was Enter only while a command ran, and it sent a bare Enter even when something was typed. Between commands every right-click opened the shortcut menu, so typing `rec` and right-clicking opened the menu instead of starting RECTANG, and at an empty prompt it didn't repeat the last command as AutoCAD does. A quick right-click now does what the Enter key does (cmdline::submit): it enters what was typed (a command name, `@10,0`), ends the input of a running command, and between commands repeats the last one. Held, it still opens the command menu or the shortcut menu; a grip with options keeps its menu; Shift/Ctrl+right-click is still the object snap menu; with the time-sensitive right-click turned off, every right-click opens the menu. With nothing typed and no command run yet, a quick click opens the shortcut menu (there is nothing to enter). time_sensitive_right_click now also checks that a quick click between commands repeats LINE, a held one opens the menu with Repeat LINE and repeats nothing, a typed `circle` starts CIRCLE and a typed `5,5` enters its centre; these checks fail without the change. docs/ui-parity.md describes the new behaviour. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/canvas.rs | 19 ++++++++------ crates/ui-egui/src/context_menu.rs | 25 +++++++++++++------ crates/ui-egui/src/options/mod.rs | 2 +- crates/ui-egui/tests/context_menus.rs | 36 +++++++++++++++++++++++++++ docs/ui-parity.md | 12 ++++++--- 5 files changed, 73 insertions(+), 21 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 983214190..eee8b7d68 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -105,7 +105,7 @@ pub struct CanvasState { /// A GRIP edit was running last frame (its grips go cold when it ends). grip_editing: bool, /// The grip whose menu (Stretch, Add Vertex, Lengthen…) a right-click opened. - grip_menu: Option<(Handle, usize)>, + pub(crate) grip_menu: Option<(Handle, usize)>, /// Dynamic block grips of the selection (cached), the one being dragged, and the list grip /// whose choices are open (and whether it opened this frame). pub(crate) dyn_grips: crate::dyngrips::Cache, @@ -1701,24 +1701,27 @@ pub fn show(app: &mut CadApp, ui: &mut egui::Ui) { } } } - // Right-click acts as Enter while a command runs (the classic CAD default; held, it opens the - // command menu); otherwise it opens the shortcut menu (Repeat, Clipboard, …). - // Shift/Ctrl+right-click opens the object snap menu. + // A quick right-click is Enter (the classic CAD default): it enters what was typed, ends the + // input of a running command, and between commands repeats the last one. Held, it opens the + // command menu or the shortcut menu (Repeat, Clipboard, …). Shift/Ctrl+right-click opens the + // object snap menu. let idle = !app.session.prompting(); if inside && pressed_secondary { app.canvas.snap_menu = mods.shift || mods.ctrl; } - if crate::context_menu::in_command(app, ui, inside, pressed_secondary) { - let _ = app.session.input(Input::Enter); - } // Right-click on a grip with options (polyline vertex, line end…) opens the grip menu. if inside && pressed_secondary && idle && !app.canvas.snap_menu { app.canvas.grip_menu = grip_at(app, &xf, hover_pos).filter(|g| !grip_options(app, *g).is_empty()); } + let enter = crate::context_menu::in_command(app, ui, inside, pressed_secondary); + if enter { + // As the Enter key does: what was typed (`rec`, `@10,0`), or Enter when nothing was. + crate::cmdline::submit(app); + } crate::dyngrips::menu(app, ui.ctx(), &xf); if idle && !app.canvas.snap_menu && app.canvas.grip_menu.is_some() { grip_menu(app, &resp); - } else if idle || app.canvas.snap_menu { + } else if (idle && !enter) || app.canvas.snap_menu { crate::context_menu::show(app, &resp); } diff --git a/crates/ui-egui/src/context_menu.rs b/crates/ui-egui/src/context_menu.rs index 68f427679..26836d513 100644 --- a/crates/ui-egui/src/context_menu.rs +++ b/crates/ui-egui/src/context_menu.rs @@ -1,6 +1,7 @@ //! The canvas's right-click menus, after AutoCAD's shortcut menus: //! -//! - **No command running** ([`entries`]): Repeat the last command, Recent Commands, the +//! - **No command running** ([`entries`], opened by holding the button: a quick right-click is +//! Enter, which repeats the last command): Repeat the last command, Recent Commands, the //! Clipboard and Isolate; with a selection the editing commands, Draw Order, Group, the edit //! commands of the selected object type, Select Similar and Deselect All; then Undo/Redo, //! Pan/Zoom, Quick Select, Find, Properties and Options. @@ -305,10 +306,11 @@ pub fn show(app: &mut CadApp, resp: &egui::Response) { #[derive(Clone, Copy, Default)] struct Press(f64, egui::Pos2); -/// The canvas's right button while a command runs (Shift/Ctrl+right-click is the snap menu's): a -/// quick click is Enter — returns `true` when the caller should send it — and a click held for -/// [`HOLD_SECS`] opens the command menu ([`command_entries`]) at the pointer (any click does with -/// the time-sensitive right-click turned off). Call it every frame +/// The canvas's right button (Shift/Ctrl+right-click is the snap menu's): a quick click is Enter +/// — returns `true` when the caller should send it; between commands that repeats the last one — +/// and while a command runs a click held for [`HOLD_SECS`] opens the command menu +/// ([`command_entries`]) at the pointer (any click does with the time-sensitive right-click turned +/// off; between commands the caller shows the shortcut menu). Call it every frame /// with whether the pointer is on the canvas and whether a right-click ended there; it also shows /// the menu while it is open. pub fn in_command(app: &mut CadApp, ui: &egui::Ui, inside: bool, right_clicked: bool) -> bool { @@ -325,16 +327,23 @@ pub fn in_command(app: &mut CadApp, ui: &egui::Ui, inside: bool, right_clicked: ctx.data_mut(|d| d.insert_temp(press_id, Press(now, p))); } let running = app.session.prompting() && !app.canvas.snap_menu; + let timed = app.options.time_sensitive_right_click; let mut open = false; + let mut quick = false; if released && let Some(Press(t0, p0)) = ctx.data_mut(|d| d.remove_temp::(press_id)) { // A drag isn't a click; a click held long enough asks for the menu. let still = pos.is_some_and(|p| p.distance(p0) <= 6.0); - let held = now - t0 >= HOLD_SECS || !app.options.time_sensitive_right_click; + let held = now - t0 >= HOLD_SECS || !timed; open = running && still && held; + quick = !held; } - let enter = running && inside && right_clicked && !open && app.options.time_sensitive_right_click; + let enter = running && inside && right_clicked && !open && timed; if !running { - return false; + // Between commands a quick click is Enter too (as in AutoCAD): it runs the typed command, + // or repeats the last one; held, it opens the shortcut menu. A grip with options keeps + // its menu. + let something = !app.cmd.buffer.trim().is_empty() || app.session.last_command.is_some(); + return timed && quick && inside && right_clicked && !app.canvas.snap_menu && app.canvas.grip_menu.is_none() && something; } let mut clicked = None; let popup = egui::Popup::new(popup_id, ctx, egui::PopupAnchor::PointerFixed, ui.layer_id()) diff --git a/crates/ui-egui/src/options/mod.rs b/crates/ui-egui/src/options/mod.rs index d2f805aa6..9468ae1b7 100644 --- a/crates/ui-egui/src/options/mod.rs +++ b/crates/ui-egui/src/options/mod.rs @@ -15,7 +15,7 @@ //! | `saveVersion` | `"2000"` … `"2018"`: the version drawings with no file yet are saved in | //! | `SAVETIME` | minutes between automatic saves, 0–600 (0: off) | //! | `SAVEFILEPATH` | the folder automatic saves go to | -//! | `timeSensitiveRightClick` | while a command runs, a quick right-click is Enter and holding the button opens the shortcut menu (default); `false`: a right-click always opens the menu | +//! | `timeSensitiveRightClick` | a quick right-click is Enter (between commands it repeats the last one) and holding the button opens the shortcut menu (default); `false`: a right-click always opens the menu | //! | `systemCursor` | keep the system cursor visible over the drawing area | //! | `historyLines` | command-line history lines, 0–12 | //! | `modelBackground`, `paperBackground` | `"#rrggbb"`, or `null` for the default | diff --git a/crates/ui-egui/tests/context_menus.rs b/crates/ui-egui/tests/context_menus.rs index 4957ad80f..7536939c3 100644 --- a/crates/ui-egui/tests/context_menus.rs +++ b/crates/ui-egui/tests/context_menus.rs @@ -257,4 +257,40 @@ fn time_sensitive_right_click() { painted(&mut app, &ctx, Vec::new(), 3.1); assert!(app.session.running.is_none(), "a quick right-click is Enter: {}", app.session.prompt_text()); assert_eq!(app.session.doc().unwrap().model.handles().len(), 1); + + // Between commands a quick right-click is Enter too: it repeats LINE (it opened the shortcut + // menu instead). + painted(&mut app, &ctx, vec![quick(true)], 4.0); + painted(&mut app, &ctx, vec![quick(false)], 4.05); + let text = painted(&mut app, &ctx, Vec::new(), 4.1); + assert!(app.session.running.is_some(), "a quick right-click repeats LINE: {}", app.session.prompt_text()); + assert!(!text.contains("Repeat LINE"), "no shortcut menu on a quick click:\n{text}"); + app.session.input(cadcraft_engine::Input::Cancel).unwrap(); + // Held, it opens the shortcut menu and repeats nothing. + painted(&mut app, &ctx, vec![quick(true)], 5.0); + painted(&mut app, &ctx, Vec::new(), 5.2); + painted(&mut app, &ctx, vec![quick(false)], 5.0 + context_menu::HOLD_SECS + 0.1); + let text = painted(&mut app, &ctx, Vec::new(), 5.5); + assert!(text.contains("Repeat LINE"), "Repeat LINE missing from the painted menu:\n{text}"); + assert!(app.session.running.is_none(), "held, no repeat: {}", app.session.prompt_text()); + + // A quick click enters what was typed, as the Enter key does (#1387): a command name between + // commands (not a repeat of LINE)… + painted( + &mut app, + &ctx, + vec![egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE }], + 5.6, + ); + app.cmd.buffer = "circle".into(); + painted(&mut app, &ctx, vec![quick(true)], 6.0); + painted(&mut app, &ctx, vec![quick(false)], 6.05); + painted(&mut app, &ctx, Vec::new(), 6.1); + assert!(app.session.prompt_text().contains("center point"), "the typed CIRCLE starts: {}", app.session.prompt_text()); + // …and a point while a command runs. + app.cmd.buffer = "5,5".into(); + painted(&mut app, &ctx, vec![quick(true)], 7.0); + painted(&mut app, &ctx, vec![quick(false)], 7.05); + painted(&mut app, &ctx, Vec::new(), 7.1); + assert!(app.session.prompt_text().contains("radius"), "the typed center is entered: {}", app.session.prompt_text()); } diff --git a/docs/ui-parity.md b/docs/ui-parity.md index d0c3fd1e3..bf29a122a 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (stable dash anchors on filled-object highlights) · **Target:** Autodesk AutoCAD 2027 for Mac (26.0) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-20 · **Change:** minor (a quick right-click is Enter between commands too, #1387) · **Target:** Autodesk AutoCAD 2027 for Mac (26.0) How CADCraft's interaction compares with AutoCAD's: point entry, object snaps, tracking, dynamic input, grips, selection, the command line, chrome and navigation. A drafter's speed in AutoCAD @@ -190,9 +190,12 @@ down-arrow options menu (DYNPROMPT), and DYNDIM. shortcuts. AutoCAD for Mac's defaults are similar in number; F4 (3D osnap) and F6 (dynamic UCS) are missing. - Delete erases the selection on macOS (#64); Escape cancels. -- Right-click on the canvas is Enter while a command runs; holding it (250 ms, AutoCAD's - time-sensitive right-click) opens the command menu: Enter, Cancel, Recent Input, the prompt's - options, Snap Overrides, Pan/Zoom. Otherwise it opens a shortcut menu (Repeat, Recent Commands, +- A quick right-click on the canvas is Enter, as in AutoCAD: it enters what was typed (a command + name, a point), ends the input of a running command, and between commands repeats the last one + (#1387). Holding it (250 ms, AutoCAD's time-sensitive right-click) opens the command menu while + a command runs: Enter, Cancel, Recent Input, the prompt's options, Snap Overrides, Pan/Zoom. + Held between commands (or any right-click with the time-sensitive right-click turned off in + Options), it opens a shortcut menu (Repeat, Recent Commands, Clipboard ▸, Isolate ▸, the selection's editing commands, Draw Order ▸, Group, the selected object type's edit commands, Select Similar, Deselect All, Undo/Redo, Pan/Zoom; #325, #512). The command line, drawing tabs, layout tabs, Layers palette rows and the Properties palette @@ -209,6 +212,7 @@ down-arrow options menu (DYNPROMPT), and DYNDIM. | 2026-10-14 | minor | Holding Shift overrides ortho while it is held (on when ORTHOMODE is off, off when it is on), as in AutoCAD | | 2026-10-16 | minor | ALIASEDIT opens the Command Aliases dialog (#1381) | | 2026-10-18 | minor | In-window menu bar: once a menu is open, pointing at another title closes it and opens that one (#1567) | +| 2026-10-20 | minor | A quick right-click is Enter between commands too: it runs the typed command or repeats the last one, and enters typed input while a command runs (#1387) | | 2026-10-13 | minor | Options ▸ Selection adds Select using two clicks only; PICKDRAG 0 disables drag-window creation/completion, 2 preserves clicks or drag, and the preference survives restart; UI pointer and profile regressions | | 2026-10-12 | minor | Selected and hovered objects redrawn in the selection colour (text and arrowheads included); Options ▸ Selection laid out as AutoCAD's: Object grouping, Show grips, grip object limit, selection preview, Visual Effect Settings (selection area, preview filter) | | 2026-10-12 | minor | Animation effects (dialog and menu fades, smoothed wheel scrolling and ⌘/Ctrl+wheel zoom) follow the operating system's setting; View ▸ Accessibility ▸ Animation Effects chooses System, On or Off | From 77b9560729038601ff922c2724a6732e08525802 Mon Sep 17 00:00:00 2001 From: Sladrian Pedroso <294190500+Sladrian@users.noreply.github.com> Date: Tue, 20 Oct 2026 14:58:38 -0300 Subject: [PATCH 2/4] contributors: add my real name for the About window credits Co-Authored-By: Claude Opus 5.5 --- contributors/people.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contributors/people.toml b/contributors/people.toml index 40ae92eb5..735996dcf 100644 --- a/contributors/people.toml +++ b/contributors/people.toml @@ -73,3 +73,8 @@ sync_github_name = false [people.gurparvez] real_name = "Gurparvez" + +[people.Sladrian] +real_name = "Sladrian Pedroso" +display_name = "Sladrian Pedroso" +sync_github_name = false From 8709920931c475fc9b26eaaa4d30616117e91295 Mon Sep 17 00:00:00 2001 From: Sladrian Pedroso <294190500+Sladrian@users.noreply.github.com> Date: Tue, 20 Oct 2026 16:58:04 -0300 Subject: [PATCH 3/4] Document canvas::show, the drawing area for one frame Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/canvas.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index eee8b7d68..ffb10590c 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -1347,6 +1347,9 @@ fn wheel_zoom_points(events: &[egui::Event], opts: &egui::InputOptions, page: f3 if points.is_finite() { points } else { 0.0 } } +/// The drawing area for one frame: lays out the model viewport tiles, handles the pointer and keys +/// on the canvas (picks and windows, grips, right-click Enter and the shortcut menus, pan and zoom) +/// and draws the drawing with its overlays. pub fn show(app: &mut CadApp, ui: &mut egui::Ui) { let t = Tokens::get(); let full = ui.available_rect_before_wrap(); From 25714cac283d60a1dbf1c13d2aa48b4ef8344d90 Mon Sep 17 00:00:00 2001 From: Sladrian Pedroso <294190500+Sladrian@users.noreply.github.com> Date: Tue, 20 Oct 2026 17:11:05 -0300 Subject: [PATCH 4/4] docs/ui-parity.md: with the time-sensitive right-click off, a right-click opens the command menu while a command runs Co-Authored-By: Claude Opus 5.5 --- docs/ui-parity.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index bf29a122a..f63417e3f 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -194,10 +194,11 @@ down-arrow options menu (DYNPROMPT), and DYNDIM. name, a point), ends the input of a running command, and between commands repeats the last one (#1387). Holding it (250 ms, AutoCAD's time-sensitive right-click) opens the command menu while a command runs: Enter, Cancel, Recent Input, the prompt's options, Snap Overrides, Pan/Zoom. - Held between commands (or any right-click with the time-sensitive right-click turned off in - Options), it opens a shortcut menu (Repeat, Recent Commands, - Clipboard ▸, Isolate ▸, the selection's editing commands, Draw Order ▸, Group, the selected - object type's edit commands, Select Similar, Deselect All, Undo/Redo, Pan/Zoom; #325, #512). + Held between commands, it opens a shortcut menu (Repeat, Recent Commands, Clipboard ▸, + Isolate ▸, the selection's editing commands, Draw Order ▸, Group, the selected object type's + edit commands, Select Similar, Deselect All, Undo/Redo, Pan/Zoom; #325, #512). With the + time-sensitive right-click turned off in Options, every right-click opens one of these menus: + the command menu while a command runs, the shortcut menu between commands. The command line, drawing tabs, layout tabs, Layers palette rows and the Properties palette have menus too (#512). Still missing: in-place layout tab rename, Move or Copy, Select All Layouts.