mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 06:28:58 +08:00
fish_job_summary: Format message better for multiline prompts
This was supposed to be number of lines in the prompt minus 1, but string repeat added one. Also it triggered even in case of the stopped job message, which is already repainted differently. So we add it when we need to repaint ourselves. As a bonus add a newline before in that case so the message isn't awkwardly printed into the commandline. Fixes #9044.
This commit is contained in:
parent
eea9d1a5de
commit
80fe0a7fcb
|
@ -35,6 +35,11 @@ function fish_job_summary -a job_id is_foreground cmd_line signal_or_end_name si
|
||||||
set cmd_line (string trim (string sub -l $truncated_len $cmd_line))$ellipsis
|
set cmd_line (string trim (string sub -l $truncated_len $cmd_line))$ellipsis
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if test $is_foreground -eq 0; and test $signal_or_end_name != STOPPED
|
||||||
|
# Add a newline *before* our message so we get the message after the commandline.
|
||||||
|
echo >&2
|
||||||
|
end
|
||||||
|
|
||||||
switch $signal_or_end_name
|
switch $signal_or_end_name
|
||||||
case STOPPED
|
case STOPPED
|
||||||
printf ( _ "fish: Job %s, '%s' has stopped\n" ) $job_id $cmd_line
|
printf ( _ "fish: Job %s, '%s' has stopped\n" ) $job_id $cmd_line
|
||||||
|
@ -49,9 +54,11 @@ 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
|
$job_id $cmd_line $signal_or_end_name $signal_desc
|
||||||
end
|
end
|
||||||
end >&2
|
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
|
if test $is_foreground -eq 0; and test $signal_or_end_name != STOPPED
|
||||||
|
# We want one newline per line in the prompt after the first.
|
||||||
|
# To ensure that, don't let `string repeat` add a newline. See #9044.
|
||||||
|
string repeat -N \n --count=(math (count (fish_prompt)) - 1) >&2
|
||||||
commandline -f repaint
|
commandline -f repaint
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user