feat(viewport): RMB 1st=Enter, 2nd=menu (no setting)

Replaces the opt-in `rmb_enter` setting (and `RMBENTER` command) with
always-on behavior. While a command is active, the first viewport
right-click acts as Enter (commit / close) and a second consecutive
right-click opens the context menu instead. Idle right-click still opens
the menu; right-drag still orbits.

The cycle is tracked per tab (`right_click_entered`) and restarts on any
other interaction — a left-click pick, a new command, an orbit, or
leaving the viewport — so the next right-click is Enter again.

Refines #185.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-27 16:32:40 +03:00
commit b691854e7a
8 changed files with 26 additions and 41 deletions

View file

@ -17,27 +17,6 @@ impl OpenCADStudio {
.push_output("PAN: drag with the left mouse button. Press Esc to exit.");
}
// RMBENTER [ON|OFF] — toggle whether a viewport right-click acts as
// Enter (commit / close) while a command is active. Idle right-click
// still opens the context menu and right-drag still orbits. The
// preference is persisted across runs.
cmd if cmd == "RMBENTER" || cmd.starts_with("RMBENTER ") => {
let arg = cmd
.split_once(' ')
.map(|(_, r)| r.trim().to_uppercase())
.unwrap_or_default();
self.rmb_enter = match arg.as_str() {
"ON" | "1" => true,
"OFF" | "0" => false,
_ => !self.rmb_enter,
};
self.command_line.push_output(if self.rmb_enter {
"RMBENTER on: right-click acts as Enter while a command is active."
} else {
"RMBENTER off: right-click opens the context menu."
});
}
// ── TABLE cell editing ─────────────────────────────────────────────
// TABLE CELL <row> <col> <text> — set text for a cell in the selected Table
cmd if cmd.starts_with("TABLE ") => {