diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-01 18:37:29 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-01 18:37:29 +0200 |
| commit | aad3c58b14aa90ef88ee12741760517862d7ec29 (patch) | |
| tree | e496b7167c91c00ba605cdc22ed62f6f77f5b8fc /frontends | |
| parent | b24fdf0d8455d23bb9ef579e8b602e44170439af (diff) | |
Strip prefilled prompt from first line.
Avoid sending duplicated prompt text back to the pane.
Diffstat (limited to 'frontends')
| -rw-r--r-- | frontends/scripts/tmux-edit-send | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/frontends/scripts/tmux-edit-send b/frontends/scripts/tmux-edit-send index a407d25..9e70544 100644 --- a/frontends/scripts/tmux-edit-send +++ b/frontends/scripts/tmux-edit-send @@ -86,7 +86,15 @@ if [ "$target_found" -ne 1 ]; then fi # Send line by line to preserve newlines reliably. +first_line=1 while IFS= read -r line || [ -n "$line" ]; do + if [ "$first_line" -eq 1 ] && [ -n "${prompt_text:-}" ]; then + if [[ "$line" == "$prompt_text"* ]]; then + line="${line#"$prompt_text"}" + line="${line# }" + fi + fi + first_line=0 tmux send-keys -t "$target" -l "$line" tmux send-keys -t "$target" Enter done < "$tmpfile" |
