mirror of
https://github.com/openai/codex.git
synced 2026-11-13 22:47:20 +00:00
Send message by default mid turn. queue messages by tab (#9077)
https://github.com/user-attachments/assets/03838730-4ddc-44df-a2c7-cb8ecda78660
This commit is contained in:
1 parent
e726a82c8a
commit
cbca43d57a
24 files changed
+875
-342
No files matched your search
@@ -1401,6 +1401,9 @@ impl ChatWidget {
|
||||
};
|
||||
|
||||
widget.prefetch_rate_limits();
|
||||
widget
|
||||
.bottom_pane
|
||||
.set_steer_enabled(widget.config.features.enabled(Feature::Steer));
|
||||
|
||||
widget
|
||||
}
|
||||
@@ -1486,6 +1489,9 @@ impl ChatWidget {
|
||||
};
|
||||
|
||||
widget.prefetch_rate_limits();
|
||||
widget
|
||||
.bottom_pane
|
||||
.set_steer_enabled(widget.config.features.enabled(Feature::Steer));
|
||||
|
||||
widget
|
||||
}
|
||||
@@ -1551,7 +1557,19 @@ impl ChatWidget {
|
||||
_ => {
|
||||
match self.bottom_pane.handle_key_event(key_event) {
|
||||
InputResult::Submitted(text) => {
|
||||
// If a task is running, queue the user input to be sent after the turn completes.
|
||||
// Enter always sends messages immediately (bypasses queue check)
|
||||
// Clear any reasoning status header when submitting a new message
|
||||
self.reasoning_buffer.clear();
|
||||
self.full_reasoning_buffer.clear();
|
||||
self.set_status_header(String::from("Working"));
|
||||
let user_message = UserMessage {
|
||||
text,
|
||||
image_paths: self.bottom_pane.take_recent_submission_images(),
|
||||
};
|
||||
self.submit_user_message(user_message);
|
||||
}
|
||||
InputResult::Queued(text) => {
|
||||
// Tab queues the message if a task is running, otherwise submits immediately
|
||||
let user_message = UserMessage {
|
||||
text,
|
||||
image_paths: self.bottom_pane.take_recent_submission_images(),
|
||||
@@ -1837,6 +1855,7 @@ impl ChatWidget {
|
||||
self.app_event_tx.send(AppEvent::InsertHistoryCell(cell));
|
||||
}
|
||||
|
||||
#[allow(dead_code)] // Used in tests
|
||||
fn queue_user_message(&mut self, user_message: UserMessage) {
|
||||
if self.bottom_pane.is_task_running() {
|
||||
self.queued_user_messages.push_back(user_message);
|
||||
@@ -2111,9 +2130,23 @@ impl ChatWidget {
|
||||
|
||||
fn on_user_message_event(&mut self, event: UserMessageEvent) {
|
||||
let message = event.message.trim();
|
||||
// Only show the text portion in conversation history.
|
||||
if !message.is_empty() {
|
||||
self.add_to_history(history_cell::new_user_prompt(message.to_string()));
|
||||
}
|
||||
|
||||
// If steer is enabled and a task is running, show hint about queuing with Tab
|
||||
if self.config.features.enabled(Feature::Steer) && self.bottom_pane.is_task_running() {
|
||||
use crate::key_hint;
|
||||
use ratatui::text::Line;
|
||||
let hint_line = Line::from(vec![
|
||||
"You can queue messages by pressing ".dim(),
|
||||
key_hint::plain(KeyCode::Tab).into(),
|
||||
]);
|
||||
self.add_to_history(history_cell::PlainHistoryCell::new(vec![hint_line]));
|
||||
}
|
||||
|
||||
self.needs_final_message_separator = false;
|
||||
}
|
||||
|
||||
fn request_exit(&self) {
|
||||
@@ -3362,6 +3395,9 @@ impl ChatWidget {
|
||||
} else {
|
||||
self.config.features.disable(feature);
|
||||
}
|
||||
if feature == Feature::Steer {
|
||||
self.bottom_pane.set_steer_enabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn set_full_access_warning_acknowledged(&mut self, acknowledged: bool) {
|
||||
|
||||
Reference in new issue
Block a user