Giter Site home page Giter Site logo

Comments (6)

Faheetah avatar Faheetah commented on June 19, 2024 1

Just a thought, you could always throw the exit in with the character checks in HighLine#get_line_raw_no_echo_mode, this would "catch" (I say that because trap doesn't seem to catch anything in the method, or anywhere for that matter). This worked for me. I am not sure off hand if \u0003 is going to be cross platform but it seems to work in POSIX environments, tested on macOS:

diff --git a/lib/highline.rb b/lib/highline.rb
index 3e60cd3..e33e13a 100755
--- a/lib/highline.rb
+++ b/lib/highline.rb
@@ -538,6 +538,7 @@ class HighLine
     terminal.raw_no_echo_mode_exec do
       loop do
         character = terminal.get_character
+        exit 130 if character == "\u0003"
         break unless character
         break if ["\n", "\r"].include? character

from highline.

abinoam avatar abinoam commented on June 19, 2024

I'll be having a look at it as soon as possible.
HighLine dates from a time where all the hard work should be done by it.
This is probably an issue related to the fact that HighLine is handling all cases related to special characters like backspace and others.
If you come up with a PR, feel free to open it, I would be thankful!
If not possible, just wait some time and I will surely try to fix it.

Thanks for reporting the issue! 👍

from highline.

aspyct avatar aspyct commented on June 19, 2024

Hi,

No worries, this isn't in any way a blocking/problematic bug, so don't feel pressed to fix this :) I might look into it on the train sometime, but no promises here :)

from highline.

Thalagyrt avatar Thalagyrt commented on June 19, 2024

I've just run into this as well - we can work around it for now, and if I have time for a PR I'll raise one, but also subscribing for notifications if you happen to fix it before I do. Cheers!

from highline.

abinoam avatar abinoam commented on June 19, 2024

io/console #getpass handles ctrl-C correctly

from highline.

abinoam avatar abinoam commented on June 19, 2024

Thanks for your suggestion @Faheetah
Sorry for the long wait.
I've just opened a PR for it #259

from highline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.