mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-09 19:55:20 +08:00

Commit 5f849d0 changed control-C to print an inverted ^C and then a newline. The original motivation was > In bash if you type something and press ctrl-c then the content of the line > is preserved and the cursor is moved to a new line. In fish the ctrl-c just > clears the line. For me the behaviour of bash is a bit better, because it > allows me to type something then press ctrl-c and I have the typed string > in the log for further reference. This sounds like a valid use case in some scenarios but I think that most abandoned commands are noise. After all, the user erased them. Also, now that we have undo that can be used to get back a limited set of canceled commands. I believe the original motivation for existing behavior (in other shells) was that TERM=dumb does not support erasing characters. Similarly, other shells like to leave behind other artifacts, for example when using tab-completion or in their interactive menus but we generally don't. Control-C is the obvious way to quickly clear a multi-line commandline. IPython does the same. For the other behavior we have Alt-# although that's probably not very well-known. Restore the old Control-C behavior of simply clearing the command line. Our unused __fish_cancel_commandline still prints the ^C. For folks who have explicitly bound ^C to that, it's probably better to keep the existing behavior, so let's leave this one. Previous attempt at #4713 fizzled. Closes #10213