Don't erase job status message when using multiline prompt

As explained in the parent commit, if we print things to the command line,
we move the cursor down before redrawing a multi-line prompt.  This is a
workaround to avoid erasing what we printed.

We forgot to do add this workaround to fish_job_summary. When running
`sleep 1 &` with a multiline prompt, the job exit notification is immediately
overwritten (most of the time).  This can be observed consistently on Linux
by waiting before redrawing:

    diff --git a/share/functions/fish_job_summary.fish b/share/functions/fish_job_summary.fish
    index a552fabbc..f457ee8e8 100644
    --- a/share/functions/fish_job_summary.fish
    +++ b/share/functions/fish_job_summary.fish
    @@ -52,6 +52,7 @@ function fish_job_summary -a job_id is_foreground cmd_line signal_or_end_name si
         string repeat \n --count=(math (count (fish_prompt)) - 1) >&2

         if test $is_foreground -eq 0; and test $signal_or_end_name != STOPPED
    +        sleep 1
             commandline -f repaint
         end
     end

Move the cursor down to work around this. In future, we could avoid calling
fish_prompt.  Also, this solution add an extra blank lines before the next
prompt.  With a real fix, we could get rid of that. Even worse, sometimes
there are two blank lines instead of one (for a two-line prompt).

Fixes #8817
This commit is contained in:
Johannes Altmanninger 2022-04-09 22:15:45 +02:00
parent b28a18be73
commit 32ed0b80da

View File

@ -49,6 +49,7 @@ function fish_job_summary -a job_id is_foreground cmd_line signal_or_end_name si
$job_id $cmd_line $signal_or_end_name $signal_desc
end
end >&2
string repeat \n --count=(math (count (fish_prompt)) - 1) >&2
if test $is_foreground -eq 0; and test $signal_or_end_name != STOPPED
commandline -f repaint