-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(tui): improve command history and interruption handling #733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add up/down arrow navigation for command history and replace error with system message for interruptions
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
recheck |
@bolinfest please checkout, let me know if any improvements needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skushagra9 thanks for taking the initiative! This is a good first cut, but I have quite a bit of feedback.
codex-rs/tui/src/chatwidget.rs
Outdated
@@ -155,15 +178,20 @@ impl ChatWidget<'_> { | |||
// Gracefully request application shutdown. | |||
let _ = self.app_event_tx.send(AppEvent::ExitRequest); | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I didn't realize we were supporting these things like in the TypeScript version...I think this needs to change because I don't think we should support both slash commands and q
. That's independent of your PR, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.filter_map(|(idx, cell)| { | ||
if let HistoryCell::UserPrompt { lines } = cell { | ||
// Get the user's message from the prompt | ||
// Assuming the message is in the second line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do something more reliable?
@@ -232,6 +237,87 @@ impl ConversationHistoryWidget { | |||
} | |||
} | |||
} | |||
|
|||
pub fn previous(&mut self) -> Option<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should have a separate struct that is associated with the BottomPane
that should be managing history instead?
Added up/down arrow navigation for command history, Esc+Esc cancellation and replace error with system message for interruptions
2025-04-30.11-33-21.mp4
Also modified /clear history - instead of showing blank screen, will show the intro message.
