diff --git a/src/app/mod.rs b/src/app/mod.rs index 66d46acb3..ba3e8a050 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1972,9 +1972,9 @@ pub enum Message { }, /// A widget captured Up/Down; resolve it only if the command input owns /// keyboard focus. - CommandLineArrowProbe { direction: ArrowKey }, + CommandLineArrowProbe { direction: ArrowKey, extend_selection: bool }, /// Result of the command-input focus query for a captured Up/Down key. - CommandLineArrowResolved { direction: ArrowKey, focused: bool }, + CommandLineArrowResolved { direction: ArrowKey, focused: bool, extend_selection: bool }, /// Toggle the dropdown listing the full command-line history. CommandHistoryToggle, /// Grab/move/release the expanded history panel's top resize edge. diff --git a/src/app/update/mod.rs b/src/app/update/mod.rs index 1957288d6..45354aa30 100644 --- a/src/app/update/mod.rs +++ b/src/app/update/mod.rs @@ -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), diff --git a/src/app/view/mod.rs b/src/app/view/mod.rs index fcd26fbe1..bfbce4288 100644 --- a/src/app/view/mod.rs +++ b/src/app/view/mod.rs @@ -2266,6 +2266,7 @@ impl OpenCADStudio { { return Some(Message::CommandLineArrowProbe { direction: arrow?, + extend_selection: modifiers.shift(), }); } // A focused web text field needs the browser clipboard;