Skip to content

Space in prompt after ctrl-D while running command #8871

@tomsmeding

Description

@tomsmeding

I normally use ctrl-D to exit fish; this works only on an empty prompt, as expected. However, sometimes I am too early with hitting ctrl-D, and enter it already while a command is still running. (My intention is then to exit the shell directly after the command; incidentally, this is often git push.) In this situation, not only does the ctrl-D not result in closing the shell, it also puts a single space character in the prompt buffer so that I have to type another backspace and then another ctrl-D to actually exit the shell.

I'm not sure whether it is a good idea for the shell to exit if a ctrl-D is already in the buffer when a command exits; exiting the shell is a somewhat destructive action. However, I do think that the space character should not be there.

Bash does not have this behaviour; the prompt input is empty after a command exits.

Recording: https://asciinema.org/a/486924 (Easy reproduction: run sleep 2, press ctrl-D while the command runs, and observe a space character in the prompt input.)

System:

  • fish --version -> 3.3.1
  • uname -a = Linux arrow 5.16.16-arch1-1 #1 SMP PREEMPT Mon, 21 Mar 2022 22:59:40 +0000 x86_64 GNU/Linux
    • (Arch Linux)
  • $TERM = tmux-256color
  • sh -c 'env HOME=$(mktemp -d) fish' has the same behaviour, as shown in the asciinema recording.

Metadata

Metadata

Assignees

No one assigned

    Labels

    regressionSomething that used to work, but was broken, especially between releases

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions