1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-29 10:02:57 +03:00

rc repl tmux: do not record repl session/window since pane might move

A pane's ID is immutable for the lifetime of the tmux server.
Same with window/session IDs.
When creating a new tmux repl, we record all three IDs to later use
them to send text to the repl.
The window/session IDs can be invalidating when a pane is moved to
a different window/session (via "tmux move-pane", "tmux move-window"
etc). This will cause repl-send-text to fail.
Fix this by dropping the redundant and potentially incorrect
window/session IDs.  The immutable pane ID is enough.
This commit is contained in:
Johannes Altmanninger 2022-10-30 19:08:50 +01:00
parent 9891f11157
commit 37dcba9089

View File

@ -19,7 +19,7 @@ define-command -hidden -params 1.. tmux-repl-impl %{
tmux_args="$1"
shift
tmux $tmux_args "$@"
printf "set-option current tmux_repl_id '%s'" $(tmux display-message -p '#{session_id}:#{window_id}.#{pane_id}')
printf "set-option current tmux_repl_id '%s'" $(tmux display-message -p '#{pane_id}')
}
}
@ -58,7 +58,7 @@ define-command -params 0..1 tmux-repl-set-pane -docstring %{
fi
curr_win="$(tmux display-message -p '#{window_id}')"
if tmux list-panes -t "$curr_win" -F \#D | grep -Fxq "%"$tgt_pane; then
printf "set-option current tmux_repl_id '%s'" $(tmux display-message -p '#{session_id}:#{window_id}.')%$tgt_pane
printf "set-option current tmux_repl_id '%s'" %$tgt_pane
else
echo 'fail The correct pane is not there. Activate using tmux-terminal-* or some other way'
fi