tmux: remove Escape/C-c/C-u clear sequence from send_prompt

The clear sequence (Escape q C-c C-u) was disrupting Claude Code's
input state, causing nudge messages to arrive as blank prompts.
Simplified to just literal text + Enter.
This commit is contained in:
ProofOfConcept 2026-03-08 18:49:30 -04:00 committed by Kent Overstreet
parent 95baba54c0
commit 77fc533631

View file

@ -30,28 +30,12 @@ pub fn find_claude_pane() -> Option<String> {
/// Send a prompt to a tmux pane. Returns true on success.
///
/// Sequence: Escape q C-c C-u (clear input), wait, type message, Enter.
/// Types the message literally then presses Enter.
pub fn send_prompt(pane: &str, msg: &str) -> bool {
let preview: String = msg.chars().take(100).collect();
info!("SEND [{pane}]: {preview}...");
let send = |keys: &[&str]| {
Command::new("tmux")
.arg("send-keys")
.arg("-t")
.arg(pane)
.args(keys)
.output()
.is_ok()
};
// Clear any partial input
if !send(&["Escape", "q", "C-c", "C-u"]) {
return false;
}
thread::sleep(Duration::from_secs(1));
// Type the message (literal mode so spaces aren't key separators)
// Type the message literally
let ok = Command::new("tmux")
.args(["send-keys", "-t", pane, "-l", msg])
.output()
@ -59,8 +43,11 @@ pub fn send_prompt(pane: &str, msg: &str) -> bool {
if !ok {
return false;
}
thread::sleep(Duration::from_millis(500));
thread::sleep(Duration::from_millis(200));
// Submit
send(&["Enter"])
Command::new("tmux")
.args(["send-keys", "-t", pane, "Enter"])
.output()
.is_ok()
}