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
Prompt & input remain on screen after hitting Ctrl-C #11
Comments
Good catch! It makes a lot more sense for the line to stay when you press so you can see what commands you've sent previously. |
I added a fix in the main branch. Take a look if you would like. The Ctrl-C issue might be a bit more annoying to fix tho... |
Sorry for not getting back to this sooner. I've tried out the code in the OP with rustyline-async 0.3.1 and crossterm 0.26.1, but the behavior seems to be the same. |
I made it so that lines stay on screen if enter is pressed to be consistent with ctrl-c. Is this not the behavior you see? |
Oh, I see what you mean. That's actually the opposite of the behavior I want, as in the program I'm writing, I already output what the user just entered, and sometimes it's with a timestamp prepended, so just getting rid of the output wouldn't get the results I want. Could you add an option for whether to leave input lines on the screen? |
Alright, I added two config options, one for enter and one for ctrl-c. There is some weird rendering behavior when switching between them in the middle of a readline, but it seems to work if you set it at the beginning. I don't have a lot of time to work on this project though, so if further changes are required, a PR would be much appreciated :) |
Thanks, that works! I submitted #13 to add a doc comment for the new method. |
Cool, I will close this when I get around to doing a cargo publish |
Fixed in Release 0.3.2 :) |
When a line of input is terminated by pressing Ctrl-C, the prompt and any text entered so far will remain on the screen even as new lines are printed below them. This is unlike lines terminated by pressing Enter, for which the line and prompt disappear, and it leads to a messy-looking interface.
Program that can be used to reproduce this behavior:
Recording of this behavior:
(Incidentally, if no text is printed in response to the Ctrl-C, things get a bit messed up on the next output; perhaps that should be a separate issue.)
The text was updated successfully, but these errors were encountered: