forked from 1b-agent/opencadstudio-upstream
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 <[email protected]>
This commit is contained in:
1 parent
0badf48454
commit
036ac7dd86
1 file changed
+9
-6
+9
-6
@@ -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
|
||||
|
||||
Reference in new issue
Block a user