tui: clear empty-arg slash drafts on dispatch

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Charles Cunningham
2026-03-15 23:32:52 -07:00
co-authored by Codex
parent a80a654b04
commit 02f6733dea
2 changed files with 15 additions and 0 deletions
+2
View File
@@ -4719,6 +4719,8 @@ impl ChatWidget {
if should_queue && !cmd.requires_interaction() {
self.queue_current_inline_bare_slash_command(cmd);
} else {
self.set_composer_text(String::new(), Vec::new(), Vec::new());
self.set_remote_image_urls(Vec::new());
self.dispatch_command(cmd);
}
return;
+13
View File
@@ -6055,6 +6055,19 @@ async fn slash_help_opens_reference_popup() {
assert!(scrolled.contains("/review <instructions>"));
}
#[tokio::test]
async fn slash_help_with_whitespace_only_args_clears_composer() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;
chat.bottom_pane
.set_composer_text("/help ".to_string(), Vec::new(), Vec::new());
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
assert!(chat.bottom_pane.has_active_view());
assert_eq!(chat.bottom_pane.composer_text(), "");
assert!(chat.remote_image_urls().is_empty());
}
#[tokio::test]
async fn slash_help_search_jumps_to_lower_match() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;