summaryrefslogtreecommitdiff
path: root/src/pane.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-27 00:12:25 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-27 00:12:25 +0300
commitbb29eedb7209a0d5e91052458ce76bc7e4259d18 (patch)
tree6c2e3f85dbf2666e37bd3c977d587e0ed5f15d25 /src/pane.rs
parent471041690af928d9a4d4cda8e4963cc7dcb3d6a8 (diff)
fix: delay agent prompt submission
refs #1878
Diffstat (limited to 'src/pane.rs')
-rw-r--r--src/pane.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/pane.rs b/src/pane.rs
index 45f4f720..c6d8c003 100644
--- a/src/pane.rs
+++ b/src/pane.rs
@@ -1107,6 +1107,28 @@ impl PaneRuntimeIo {
PaneRuntimeIo::TestChannel { sender, .. } => sender.try_send(bytes),
}
}
+
+ fn send_bytes_after(&self, bytes: Bytes, delay: std::time::Duration) {
+ match self {
+ PaneRuntimeIo::Actor(actor) => {
+ let actor = actor.clone();
+ tokio::spawn(async move {
+ tokio::time::sleep(delay).await;
+ if let Err(err) = actor.write_user_input(bytes).await {
+ warn!(error = %err, "failed to send delayed PTY input");
+ }
+ });
+ }
+ #[cfg(test)]
+ PaneRuntimeIo::TestChannel { sender, .. } => {
+ let sender = sender.clone();
+ tokio::spawn(async move {
+ tokio::time::sleep(delay).await;
+ let _ = sender.send(bytes).await;
+ });
+ }
+ }
+ }
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -2628,6 +2650,10 @@ impl PaneRuntime {
self.io.try_send_bytes(bytes)
}
+ pub fn send_bytes_after(&self, bytes: Bytes, delay: std::time::Duration) {
+ self.io.send_bytes_after(bytes, delay);
+ }
+
pub async fn send_paste(&self, text: String) -> Result<(), mpsc::error::SendError<Bytes>> {
self.send_bytes(self.paste_payload(text)).await
}