Skip to content

Multiple empty lines printed to the terminal after stopping a job #9044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sklirg opened this issue Jun 28, 2022 · 0 comments
Closed

Multiple empty lines printed to the terminal after stopping a job #9044

sklirg opened this issue Jun 28, 2022 · 0 comments
Labels
bug Something that's not working as intended
Milestone

Comments

@sklirg
Copy link

sklirg commented Jun 28, 2022

  • Fish version:
fish --version
    echo $version
fish, version 3.5.0
3.5.0
  • OS: MacOS Monterey, 12.4
  • Terminal: Terminal.app (MacOS default terminal)

Hi! Thanks for fish. I really like it. 🐟

After upgrading to fish v3.5.0, after stopping foreground jobs (e.g. ctrl-z) such as vim or less, two empty lines are printed before the prompt shows.

Example:

sklirg@box:~
➤ less foo
fish: Job 1, 'less foo' has stopped


sklirg@box:~
➤

After digging a bit, it seems like 32ed0b8 (the fix for #8817) might be the culprit, at least running fish --debug='*' prints out two empty lines in the middle of the output after stopping the job (less foo + ctrl z):

...
proc-internal-proc: Created internal proc 7 to write output for proc 'string'
iothread: enqueuing work item (count is 1)
iothread: notifying thread: 0x100d3c580
exec-job-exec: Executed job 0 from command 'string repeat \n --count=(math (count (fish_prompt)) - 1) >&2'
proc-job-run: Run job 0 (string repeat \n --count=(math (count (fish_prompt)) - 1) >&2), UNCOMPLETED, INTERACTIVE
topic-monitor: TID 1 local  0,21,6 : current 0,21,6
topic-monitor: TID 1 becoming reader
iothread: pthread 0x16f753000 got work


proc-internal-proc: Internal proc 7 exited with status 0

I searched for the string repeat code and saw it was changed between v3.5.0 and v3.4.1, so I tried downgrading to v3.4.1 and it works as expected there.

Furthermore, executing the referenced (changed) function directly in the shell (with some dummy variables) produce different output between the versions:

sklirg@box:~
➤ fish
sklirg@box:~
➤ fish --version && echo $version
fish, version 3.5.0
3.5.0
sklirg@box:~
➤ fish_job_summary 1 1 3 4


sklirg@Magla:~
➤ /usr/local/bin/fish
sklirg@box:~
➤ /usr/local/bin/fish --version && echo $version
fish, version 3.4.1
3.4.1
sklirg@box:~
➤ fish_job_summary 1 1 3 4
sklirg@box:~
➤

Downgrading to v3.4.1 also solves the issue with two blank lines before the prompt:

sklirg@box:~
➤ /usr/local/bin/fish --version && echo $version
fish, version 3.4.1
3.4.1
sklirg@box:~
➤ less foo
fish: Job 1, 'less foo' has stopped
sklirg@box:~
➤

The same happens with the suggested empty config/$HOME:

sklirg@box:~
➤ sh -c 'env HOME=$(mktemp -d) fish'
sklirg@box:/U/sklirg
➤ touch foo
sklirg@box:/U/sklirg
➤ less foo
fish: Job 1, 'less foo' has stopped


sklirg@box:/U/sklirg
➤ fg
Send job 1 (less foo) to foreground
sklirg@box:/U/sklirg
➤ fish --version && echo $version 
fish, version 3.5.0
3.5.0
sklirg@box:/U/sklirg
➤ /usr/local/bin/fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
sklirg@box /U/sklirg> env | grep HOME
XDG_CONFIG_HOME=/var/folders/8t/sqnb2_j56q94_gcl33j0n_dh0000gp/T/tmp.JnygqqGq/.config
HOME=/var/folders/8t/sqnb2_j56q94_gcl33j0n_dh0000gp/T/tmp.JnygqqGq
sklirg@box /U/sklirg> less foo
fish: Job 1, 'less foo' has stopped
sklirg@box /U/sklirg> fg
Send job 1 (less foo) to foreground
sklirg@box /U/sklirg> /usr/local/bin/fish --version && echo $version
fish, version 3.4.1
3.4.1
sklirg@box /U/sklirg> 

If you need anything else from me, hit me up and I'll do my best to help :)

@faho faho closed this as completed in 80fe0a7 Jun 28, 2022
@faho faho added the bug Something that's not working as intended label Jun 28, 2022
@faho faho added this to the fish 3.6.0 milestone Jun 28, 2022
@zanchey zanchey modified the milestones: fish 3.6.0, fish 3.5.1 Jul 13, 2022
zanchey pushed a commit that referenced this issue Jul 13, 2022
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.

(cherry picked from commit 80fe0a7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

3 participants