forked from 1b-agent/opencadstudio-upstream
feat: command history navigation with up/down arrow keys
CommandLine now records every submitted command in a recall list (up to 50 entries). Pressing ↑ in the command input walks back through the list, ↓ moves forward, and returning to the newest position restores the draft text the user had typed before navigating. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
0868a1719c
commit
80ca095121
4 files changed
+76
-1
No files matched your search
@@ -176,6 +176,10 @@ pub enum Message {
|
||||
CommandInput(String),
|
||||
CommandSubmit,
|
||||
Command(String),
|
||||
/// Recall previous command in history (↑ arrow key).
|
||||
CommandHistoryPrev,
|
||||
/// Recall next command in history (↓ arrow key).
|
||||
CommandHistoryNext,
|
||||
ToggleLayers,
|
||||
LayerToggleVisible(usize),
|
||||
LayerToggleLock(usize),
|
||||
|
||||
+15
-1
@@ -248,7 +248,21 @@ impl H7CAD {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::CommandInput(s) => { self.command_line.input = s; Task::none() }
|
||||
Message::CommandInput(s) => {
|
||||
// Any manual typing resets the history recall cursor.
|
||||
self.command_line.input = s;
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::CommandHistoryPrev => {
|
||||
self.command_line.history_prev();
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::CommandHistoryNext => {
|
||||
self.command_line.history_next();
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::CommandSubmit => {
|
||||
let i = self.active_tab;
|
||||
|
||||
@@ -320,6 +320,12 @@ impl H7CAD {
|
||||
{
|
||||
Some(Message::DeleteSelected)
|
||||
}
|
||||
keyboard::Key::Named(keyboard::key::Named::ArrowUp) => {
|
||||
Some(Message::CommandHistoryPrev)
|
||||
}
|
||||
keyboard::Key::Named(keyboard::key::Named::ArrowDown) => {
|
||||
Some(Message::CommandHistoryNext)
|
||||
}
|
||||
keyboard::Key::Named(keyboard::key::Named::F3) => {
|
||||
Some(Message::ToggleSnapEnabled)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user