Skip to content
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

Issue #236 - Handle Ctrl-C when Question#echo = false (raw_no_echo_mode) #259

Merged
merged 4 commits into from
Jan 6, 2023

Conversation

abinoam
Copy link
Collaborator

@abinoam abinoam commented Jan 4, 2023

Fix #236

Hi @Fahhetah,

I've set the author's commit to your e-mail to honor your suggestion.
But I've changed exit 130 to raise Interrupt so it stays in line with Ruby standard behavior when receiving ctrl-C.
I'll not merge it yet as I'm investigating a little further if I could have a better more complete approach.
Because treating all ctrl codes one by one seems not a good way for the long run.

cc: @Faheetah @Thalagyrt @aspyct


Of note, this commit message:

Handle interrupts directly at io/console was possible with the introduction of intr option to getch.

Added to io/console at commit at 24, September, 2019

Released in Ruby 2.7.0, released at 25, December, 2019

Documented at 17, February, 2020

Documented in Ruby 2.7.1, released at 31, March, 2020

We should review all the code for other instances of handling control inputs like getch when echo is not false.
And, we will probably have to think about deprecating rubies older than 2.7 because they will have a different behavior. (Although the tests are passing because we use a mock with StringIO objects, not the actual consoles.

@abinoam abinoam marked this pull request as ready for review January 6, 2023 22:16
@abinoam abinoam merged commit 8e5f773 into JEG2:master Jan 6, 2023
@abinoam abinoam changed the title Handle Ctrl-C when Question#echo = false (raw_no_echo_mode) Issue #236 - Handle Ctrl-C when Question#echo = false (raw_no_echo_mode) Jan 6, 2023
abinoam added a commit that referenced this pull request Apr 27, 2023
Ruby 2.7 is tagged End of Life (not even security maintanence) since this month.
We (Highline) traditionally try to maintain compatibility with old rubies.
But rubies bellow 2.7.1 lack "io/console" or they have incompatibilities.
(as discussed in PR #259)

So, this EOL of 2.7 signal to us that is time for us to move on.
People relying on old versions of Highline will probably face no problem with it.
But we will be free to start removing old code that is necessary only for
retrocompatibility in newer versions.
@abinoam abinoam mentioned this pull request Apr 27, 2023
abinoam added a commit that referenced this pull request Apr 27, 2023
Ruby 2.7 is tagged End of Life (not even security maintanence) since this month.
We (Highline) traditionally try to maintain compatibility with old rubies.
But rubies bellow 2.7.1 lack "io/console" or they have incompatibilities.
(as discussed in PR #259)

So, this EOL of 2.7 signal to us that is time for us to move on.
People relying on old versions of Highline will probably face no problem with it.
But we will be free to start removing old code that is necessary only for
retrocompatibility in newer versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ctrl-C improperly handled when q.echo = false
2 participants