forked from 1b-agent/opencadstudio-upstream
fix(mtext): keep arrows in editor
Route captured arrows to the MText caret only while the hidden command input retains focus.\n\nRefs #655
This commit is contained in:
commit
76ad642d0c
3 files changed
+22
-4
No files matched your search
+19
-2
@@ -1559,20 +1559,37 @@ impl OpenCADStudio {
|
||||
))
|
||||
}
|
||||
|
||||
Message::CommandLineArrowProbe { direction } => {
|
||||
Message::CommandLineArrowProbe {
|
||||
direction,
|
||||
extend_selection,
|
||||
} => {
|
||||
iced::widget::operation::is_focused(iced::widget::Id::new(
|
||||
crate::ui::command_line::CMD_INPUT_ID,
|
||||
))
|
||||
.map(move |focused| Message::CommandLineArrowResolved {
|
||||
direction,
|
||||
focused,
|
||||
extend_selection,
|
||||
})
|
||||
}
|
||||
|
||||
Message::CommandLineArrowResolved { direction, focused } => {
|
||||
Message::CommandLineArrowResolved {
|
||||
direction,
|
||||
focused,
|
||||
extend_selection,
|
||||
} => {
|
||||
if !focused {
|
||||
return Task::none();
|
||||
}
|
||||
// The editor inherits arrows captured by the focused command line.
|
||||
if self.mtext_editor.is_some() {
|
||||
match direction {
|
||||
ArrowKey::Up => self.mtext_caret_move_vertical(1, extend_selection),
|
||||
ArrowKey::Down => self.mtext_caret_move_vertical(-1, extend_selection),
|
||||
ArrowKey::Left | ArrowKey::Right => {}
|
||||
}
|
||||
return Task::none();
|
||||
}
|
||||
match direction {
|
||||
ArrowKey::Up => self.update(Message::CommandHistoryPrev),
|
||||
ArrowKey::Down => self.update(Message::CommandHistoryNext),
|
||||
|
||||
Reference in new issue
Block a user