summaryrefslogtreecommitdiff
path: root/frontends/scripts
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-01 18:19:03 +0200
committerPaul Buetow <paul@buetow.org>2026-02-01 18:19:03 +0200
commitb24fdf0d8455d23bb9ef579e8b602e44170439af (patch)
tree5e84976d4af37dd6d03539595d2807d5c684a107 /frontends/scripts
parent507e3cae3d4e3939dad1af33feff945ab850cb72 (diff)
Prefill editor from cursor-agent prompt line.
Capture the last prompt line and seed the temp file for editing.
Diffstat (limited to 'frontends/scripts')
-rw-r--r--frontends/scripts/tmux-edit-send6
1 files changed, 6 insertions, 0 deletions
diff --git a/frontends/scripts/tmux-edit-send b/frontends/scripts/tmux-edit-send
index 5edafe1..a407d25 100644
--- a/frontends/scripts/tmux-edit-send
+++ b/frontends/scripts/tmux-edit-send
@@ -50,6 +50,12 @@ cleanup() {
}
trap cleanup EXIT
+prompt_text="$(tmux capture-pane -p -t "$target" -S -2000 2>/dev/null | \
+ awk '/^ *│ *→/ && index($0,"INSERT")==0 && index($0,"Add a follow-up")==0 {line=$0} END { if (line!="") { sub(/^.*→ ?/, "", line); sub(/[[:space:]│]+$/, "", line); print line } }')"
+if [ -n "$prompt_text" ]; then
+ printf '%s\n' "$prompt_text" > "$tmpfile"
+fi
+
"$editor" "$tmpfile"
log "editor exited with status $?"