rc repl tmux: show error when the repl pane is gone

tmux-send-text would silently fail when the repl is no more.  Let's
instead print an error, pointing the user to the *debug* buffer which
has tmux' stderr.
This commit is contained in:
Johannes Altmanninger 2022-10-30 18:52:02 +01:00
parent 91d45a100a
commit 79db90349d

View File

@ -71,13 +71,14 @@ define-command -hidden tmux-send-text -params 0..1 -docstring %{
tmux-send-text [text]: Send text to the REPL pane. tmux-send-text [text]: Send text to the REPL pane.
If no text is passed, then the selection is used If no text is passed, then the selection is used
} %{ } %{
nop %sh{ evaluate-commands %sh{
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
tmux set-buffer -b kak_selection -- "${kak_selection}" tmux set-buffer -b kak_selection -- "${kak_selection}"
else else
tmux set-buffer -b kak_selection -- "$1" tmux set-buffer -b kak_selection -- "$1"
fi fi
tmux paste-buffer -b kak_selection -t "$kak_opt_tmux_repl_id" tmux paste-buffer -b kak_selection -t "$kak_opt_tmux_repl_id" ||
echo 'fail tmux-send-text: failed to send text, see *debug* buffer for details'
} }
} }