Control-C to simply clear commandline buffer again#10213
Closed
krobelus wants to merge 1 commit into
Closed
Conversation
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, undo 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 fish-shell#4713 fizzled. TODO: changelog, instructions to restore the other behavior.
Member
|
I'm fine either way. I will note that this is nicer now that we have undo, so you can actually get the old commandline back by pressing ctrl-z. |
|
My comment in the previous thread is still true today, but as long as "I can simply revert the behaviour to the current behaviour by defining the function in my user config", then I suppose it's fine. Also, as said, undo didn't exist back then and that's something I use a lot nowadays. |
Member
|
I'm still in favor of this and the undo behavior makes it even more compelling! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit 5f849d0 changed control-C to print an inverted ^C and then a newline.
The original motivation was
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, undo
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.
TODO: changelog, instructions to restore the other behavior.