fish-shell/tests/checks/tmux-signal.fish
Johannes Altmanninger 5ba21cd290 Send repaint requests through the input queue again
Another consequence of a583fe723 ("commandline -f foo" to skip queue
and execute immediately, 2024-04-08) is that "commandline -f repaint"
will paint the prompt with the current value of $status which might be
set from a shell command in a the currently executing binding, instead of
waiting for the top-level status. This is wrong, at least historically. It
surfaces in bindings like alt-w which always paint a status value of [1]
when on single-lines commandlines.

Another regression is that a redundant repaint in a signal handler outputs
an extra prompt.

Fix both by making repaint commands go over the input queue again.  This way,
they are always run with a good commandline state.  There is no need to
repaint immediately because I don't think anyone has a data dependency on it
(we currently don't expose the prompt string), it's only for rendering.
2024-04-19 12:05:27 +02:00

19 lines
460 B
Fish

#RUN: %fish %s
#REQUIRES: command -v tmux
isolated-tmux-start
isolated-tmux send-keys '
function usr1_handler --on-signal SIGUSR1
echo Got SIGUSR1
# This repaint is not needed but make sure it is coalesced.
commandline -f repaint
end
' Enter
isolated-tmux send-keys C-l 'kill -SIGUSR1 $fish_pid' Enter
tmux-sleep
isolated-tmux capture-pane -p
# CHECK: prompt 1> kill -SIGUSR1 $fish_pid
# CHECK: Got SIGUSR1
# CHECK: prompt 2>