-
Notifications
You must be signed in to change notification settings - Fork 40
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
Feature: Using ctrl-C #33
Comments
The idea sounds awesome! Is your proposal to work on that still relevant, if so, I (and I believe community) would really appreciate that! |
Yup! I just didn't want to put in a bunch of effort and then get it rejected (has happened before to me) 😅
I'll start working on it and then submit a WIP PR so you can follow along and maybe help with some suggestions along the way. Thanks!
~Jeremy
… On Jan 31, 2017, at 3:46 AM, Sergey Potapov ***@***.***> wrote:
The idea sounds awesome! Is your proposal to work on that still relevant, if so, I (and I believe community) would really appreciate that!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Sounds good! Thanks again for your support and initiative! |
Maybe something like this would work? https://stackoverflow.com/a/41917863/5655255 void int_handler(int status)
{
printf("\n"); // Move to a new line
rl_on_new_line(); // Regenerate the prompt on a newline
rl_replace_line("", 0); // Clear the previous text
rl_redisplay();
} We'd just need to bind |
Possibly. I will need to look back in to it. I had been waiting for this thing to get fixed before I attempted this again, but maybe it's fixed now? Thanks for the suggestion @bew 👍 |
When using
IRB
, if you're writing out multi-line code, and you make a typo, you can usectrl-C
to sort of reset you back to normal. Take this for example:With ICR currently, if you hit
ctrl-C
, then it will completely exits the session back to your main prompt. If you've been spending time building out an example, then you will have lost setting up variables and such.Since this needs to work a bit different than how IRB works, my plan would be to create some sort of status that knows if the current state is ok or not. Then catching
Signal::INT
would basically clear everything back to the last good state.If you like the idea, then I'll work on sending a PR.
The text was updated successfully, but these errors were encountered: