fix(input): fire a rebound SPACE only from the command line

#1713 dispatched a captured SPACE as a shortcut whenever it was rebound,
so with SPACE on FINALIZE a space typed into any other text field (layer
names, Properties, find) also ran FINALIZE, and the space it typed stayed
in the command line. Ask whether the command input has focus before
running the binding, and drop the space the field already inserted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-11 23:38:06 +03:00
1 parent c56cdd6a26
commit 7e0866e647
3 files changed
+40 -67

No files matched your search

+20
View File
@@ -23,6 +23,8 @@ fn is_modal_blocked_key_msg(msg: &Message) -> bool {
| Message::ArrowKeyPressed { .. }
| Message::CommandLineArrowProbe { .. }
| Message::CommandLineArrowResolved { .. }
| Message::CommandLineSpaceProbe
| Message::CommandLineSpaceResolved
| Message::DynTabNext
| Message::DynTabPrev
| Message::MTextCaretMove(_)
@@ -2314,6 +2316,24 @@ impl OpenCADStudio {
))
}
Message::CommandLineSpaceProbe => iced::widget::operation::is_focused(
iced::widget::Id::new(crate::ui::command_line::CMD_INPUT_ID),
)
.map(|focused| {
if focused {
Message::CommandLineSpaceResolved
} else {
Message::Noop
}
}),
Message::CommandLineSpaceResolved => {
if self.command_line.input.ends_with(' ') {
self.command_line.input.pop();
}
self.update(Message::ShortcutPressed("SPACE".to_string()))
}
Message::CommandLineArrowProbe {
direction,
extend_selection,