-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Ctrl-C overwrites multi-line prompt #3537
Comments
I can reproduce this. It seems we don't adjust the prompt position properly in this case, so we'll overwrite parts of the output (i.e. the previous commandline contents) with the prompt. As a workaround, in for i in (seq (commandline -L)) (seq 2 1 (count (fish_prompt))) This will rerun your prompt function which should usually be safe. I'm not going to commit this because I'm pretty sure that it should be fixed in c++ (since this might show up elsewhere) and because I don't know how BSD seq handles this (@floam?). |
I've had an issue that I think is related to this one (appeared after If I apply @faho's fix (with an extra closing paren for syntactic correctness), it seems to work: FYI, I'm running Manjaro with |
@bacondropped: Yes, that's the same issue. |
Well, if
|
So all we'd need is to ignore stderr? I wanted it to not generate a sequence. That was me being a smarty-pants. Though again this executes fish_prompt again which might be slow or wrong, and I'm pretty sure that this is a symptom of a larger problem. |
Probably the entire |
Even with @faho's workaround, the bug is still there when pressing ctrl-c after a multiline command. eg:
|
I don't have the problem @karate does: Ctrl-C inserts a highlighted EDIT: actually, it sporadically inserts one-three empty lines after the broken command and before the multiline prompt. I can't seem to find any logic in when exactly it does that, but it seems to preserve both the interrupted command and the new prompt. |
I'm seeing this with a single line prompt, but I do have a function that gets run on change of
|
After upgrading to 2.4 Ctrl-C shows a highlighted |
Same, to be honest. I'd prefer it to be configurable, though, but the user-friendly default is clearing for me, as opposed to breaking. |
Rejoice, it is! function fish_user_key_bindings
bind \cc 'commandline ""'
end |
Thanks! that solved my problem completely. |
And there was much rejoicing! Works perfectly both with and without the first workaround. |
Yeah I found this #3535 (comment) after commenting on this issue. I wonder if any of these approaches have benefits over the other one though. Currently I'm using the ridiculousfish approach and it seems to be alright. |
I'm in favor of removing the "Hit end of history..." stuff if someone wants to open a PR. |
I'm making one. I'd like there to be some negative feedback, I prefer to output a terminal bell. |
No PR yet, but I like what floam@d524bad does |
@floam, any progress? Want to try and get a simple change in for 2.5b1? |
Moving the milestone since it would not be appropriate to cherry-pick a change to this behavior even if floam merged a fix today. |
Any progress on this issue? Ctrl-C has been broken for quite some time now for multiline prompts. |
Not at this stage; you can always subscribe to notifications using the GitHub interface if you're interested. |
We have a similar issue with pure-fish/pure#157`, using a multiline prompt, hitting Ctrl+C when prompt command has text display double home folder.
|
Okay, it's possible I have a fix for this, and it's laughably simple: # This is meant to be bound to something like \cC.
function __fish_cancel_commandline
# Close the pager if it's open (#4298)
commandline -f cancel
set -l cmd (commandline)
if test -n "$cmd"
commandline -C 1000000
if set -q fish_color_cancel
echo -ns (set_color $fish_color_cancel) "^C" (set_color normal)
else
echo -ns "^C"
end
if command -sq tput
# Clear to EOL (to erase any autosuggestion).
echo -n (tput el; or tput ce)
end
for i in (seq (commandline -L))
echo ""
end
commandline ""
commandline -f execute
end
end |
@faho I have a similar workaround ( |
See fish-shell/fish-shell#3537 for more details.
@faho: Thanks for the suggestion in #3537 (comment)! That Anyway, I'm assuming that your change eb35975 (the real |
I can't reproduce this anymore with the new bind function, so I'm closing it. |
fish version installed (version 2.4.0):
OS/terminal used: Fedora 24, gnome-terminal
When using a multi-line prompt, pressing ctrl-c will not preserve previously written command
Reproduction steps
fish_prompt
function to show newlinesasdfasdf[CTRL-C]
The text was updated successfully, but these errors were encountered: