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:
parent
95baba54c0
commit
77fc533631
1 changed files with 7 additions and 20 deletions
|
|
@ -30,28 +30,12 @@ pub fn find_claude_pane() -> Option<String> {
|
||||||
|
|
||||||
/// Send a prompt to a tmux pane. Returns true on success.
|
/// 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 {
|
pub fn send_prompt(pane: &str, msg: &str) -> bool {
|
||||||
let preview: String = msg.chars().take(100).collect();
|
let preview: String = msg.chars().take(100).collect();
|
||||||
info!("SEND [{pane}]: {preview}...");
|
info!("SEND [{pane}]: {preview}...");
|
||||||
|
|
||||||
let send = |keys: &[&str]| {
|
// Type the message literally
|
||||||
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)
|
|
||||||
let ok = Command::new("tmux")
|
let ok = Command::new("tmux")
|
||||||
.args(["send-keys", "-t", pane, "-l", msg])
|
.args(["send-keys", "-t", pane, "-l", msg])
|
||||||
.output()
|
.output()
|
||||||
|
|
@ -59,8 +43,11 @@ pub fn send_prompt(pane: &str, msg: &str) -> bool {
|
||||||
if !ok {
|
if !ok {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
thread::sleep(Duration::from_millis(500));
|
thread::sleep(Duration::from_millis(200));
|
||||||
|
|
||||||
// Submit
|
// Submit
|
||||||
send(&["Enter"])
|
Command::new("tmux")
|
||||||
|
.args(["send-keys", "-t", pane, "Enter"])
|
||||||
|
.output()
|
||||||
|
.is_ok()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue