Skip to content

Old behavior of ctrl-c on 4.0b1 doesn't work with multi-line prompt #10935

@superobertking

Description

@superobertking

Version: fish, version 4.0b1-03a9f4
OS: Darwin 23.6.0 Darwin Kernel Version 23.6.0: Thu Sep 12 23:36:12 PDT 2024; root:xnu-10063.141.1.701.1~1/RELEASE_ARM64_T6020 arm64
$TERM: xterm-256color

Regarding this change of behavior mention in release note:

ctrl-c during command input no longer prints ^C and a new prompt, but merely clears the command line. This restores the behavior from version 2.2. To revert to the old behavior, use bind ctrl-c __fish_cancel_commandline (#10213).

I was trying to revert back to the old behavior. However, setting bind -M insert ctrl-c __fish_cancel_commandline does not work well with multi-line prompt (I am using starship).

On old fish 3.7.1:

/tmp/testgit on ᚠ master
❯ asdfa^C
/tmp/testgit on ᚠ master
❯

On 4.0b1-03a9f4:

/tmp/testgit on ᚠ master
/tmp/testgit on ᚠ master
❯

The ^C was actually printed, but immediately got overwritten by the new repaint. It should repaint on a newline instead of resetting back to beginning of current line.

On 3.7.1, both the preset cancel-commandline and binding __fish_cancel_commandline work fine and they both keep the old command line.

❯ bind \cc
bind --preset -m insert \cc cancel-commandline repaint-mode   # either works fine
bind -m insert \cc __fish_cancel_commandline   # either works fine

BTW, one suggestion for the Release Note: for the bind commands, maybe also mention that vim binding users also need -M insert and -M visual for the binding to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions