From 036ac7dd8617c865ad5543899524419412f52d24 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Mon, 15 Jun 2026 00:35:03 +0300 Subject: [PATCH] fix(command): submit typed command on Enter without focusing the input (#99) Unfocused keyboard input routes through the global subscription: typed characters reach the command line, but Enter went to CommandFinalize, which only forwarded the buffer to CommandSubmit while a command was already active. At startup (before the window grabs focus) typing a command name and pressing Enter did nothing until the user clicked into the command line. Forward any non-empty buffer to CommandSubmit regardless of active-command state. Co-Authored-By: Claude Opus 4.8 --- src/app/update.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/app/update.rs b/src/app/update.rs index 1a0ab4f57..f1ca68c3a 100644 --- a/src/app/update.rs +++ b/src/app/update.rs @@ -1376,13 +1376,16 @@ impl OpenCADStudio { let idx = self.grip_popup.as_ref().map(|p| p.selected).unwrap_or(0); return Task::done(Message::GripMenuPick(idx)); } - // Pending typed command-line text (e.g. an option keyword like - // "R") must be submitted rather than finalising the command. - // The focused-input Enter routes through CommandSubmit, but a - // command started from the ribbon never focuses the field, so - // its Enter arrives here — forward to the same submit path. + // Any typed command-line text must be submitted rather than + // finalising. The focused-input Enter routes through + // CommandSubmit, but when the field isn't focused — e.g. at + // startup before the window grabs focus, or a command started + // from the ribbon — its Enter arrives here. Forward a non-empty + // buffer to the same submit path so typing a command name (or + // an option keyword like "R") and pressing Enter works without + // first clicking into the command line (issue #99). let i = self.active_tab; - if self.tabs[i].active_cmd.is_some() && !self.command_line.input.trim().is_empty() { + if !self.command_line.input.trim().is_empty() { return self.update(Message::CommandSubmit); } // A typed dynamic-input value commits as a point pick