Giter Site home page Giter Site logo

JRuby 1.7 about highline HOT 22 CLOSED

jeg2 avatar jeg2 commented on July 18, 2024
JRuby 1.7

from highline.

Comments (22)

mnzaki avatar mnzaki commented on July 18, 2024

JRuby moved from jline1 to jline2.7 on April 17 (jruby/jruby@bb7dc31)
I suppose highline is expecting jline1

from highline.

JEG2 avatar JEG2 commented on July 18, 2024

I would love to see this fixed. Anyone who know's jline and offers up a patch is my hero.

from highline.

mnzaki avatar mnzaki commented on July 18, 2024

I was just beginning work on a patch. Quick clarification: what's up with all the disableEcho and enableEcho for JRuby and not for other platforms? A lot of the calls (gets, readline, getbyte, etc) on $stdin/$stdout work for JRuby just as well, and I don't see why all the extra logic (and echo disable/re-enable) is needed.

from highline.

mnzaki avatar mnzaki commented on July 18, 2024

Here's an initial patch, mnzaki/highline@721bc1e6194d7a79b19
I'm going to try to refactor a few parts then issue a pull request.

from highline.

mnzaki avatar mnzaki commented on July 18, 2024

I have pushed more changes to the jruby-1.7 branch, which clean up the terminal code a bit. This needs more testing of course. I've tested ncurses, stty and jline.

stty and jline seem fine.

ncurses breaks the console if the process gets a SIGSTOP (ctrl-z on the terminal) and SIGCONT ("fg").
Also, after ending the process the terminal does not handle scroll events properly anymore. Usually when in secondary screen mode, the scroll events simply produce up and down keypresses, and when secondary screen mode is terminated, the scroll events are captured again. It seems like we are not closing down ncurses properly or something else is wrong.

I'd recommend giving 'jline' higher priority than 'ncurses' mode.

If you wish, you can just pull the first commit which makes minimal changes (specific to JRuby) and does not touch anything else.

from highline.

JEG2 avatar JEG2 commented on July 18, 2024

Wow, thanks for working on this.

I agree with you assessment. Let's bump line over ncurses.

from highline.

mnzaki avatar mnzaki commented on July 18, 2024

I need the JRuby functionality, so it's only natural that I work on it :-D

The ncurses terminal breakage is actually a JRuby bug, and an important one IMO. JRuby doesn't seem to run the 'ensure' blocks if the process gets a SIGINT, so NCurses::endwin is never called if we die suddenly. I'll be reporting this. MRI handles this correctly, and ncurses works well there (sort of; I still don't like the occasional screen blank).

I've rearranged the choices to give jline (which is much more reliable) a higher priority, and I removed the comment about needing ncurses for jruby.

BTW, all these changes will probably break highline horribly for users of jruby before 1.5 (and possible 1.6)

from highline.

JEG2 avatar JEG2 commented on July 18, 2024

Hmm, we probably need an option for older JRuby versions. Thoughts?

from highline.

mnzaki avatar mnzaki commented on July 18, 2024

Not sure. You could keep the changes on a different branch for a couple months then merge into master later. The JLine change in JRuby has been since mid April, that's about 2 months ago. I'm guessing there'll be considerably more people using the new JRuby in a month or two.

from highline.

tomdz avatar tomdz commented on July 18, 2024

You could distinguish the jruby versions using JRUBY_VERSION, and keep the jline1 code around for < 1.7.

from highline.

JEG2 avatar JEG2 commented on July 18, 2024

I think I prefer tomdz's approach. HighLine is a general purpose library and we're going to need to support it for a while yet.

from highline.

mnzaki avatar mnzaki commented on July 18, 2024

That sounds better. What do you think of the rest of the changes in the branch though?
I'm off on vacation for a week, I might work on this when I'm back if you don't.

from highline.

JEG2 avatar JEG2 commented on July 18, 2024

It's looking good to me. I think you're on the right track.

from highline.

nirvdrum avatar nirvdrum commented on July 18, 2024

If it helps any, I've tried @mnzaki's branch on JRuby 1.7.0-preview2 in the context of Capistrano and everything has been working great.

from highline.

JEG2 avatar JEG2 commented on July 18, 2024

Great. So we just need to sort out the backwards compatibility issues and these changes are a go.

from highline.

nirvdrum avatar nirvdrum commented on July 18, 2024

@tomdz's solution makes sense. Otherwise, you could try to require one, rescue the exception, and then try to require the other.

from highline.

JEG2 avatar JEG2 commented on July 18, 2024

Yeah, we just need someone to get the patch ready.

from highline.

markmandel avatar markmandel commented on July 18, 2024

@mnzaki - Just tested your branch as well. Worked a charm (was having exactly the same issue). Thanks for putting in the effort.

from highline.

mnzaki avatar mnzaki commented on July 18, 2024

Apologies for the delay, but my organization has moved away from JRuby for now.
I have update the branch and added back support for 1.6
I have done some basic testing under JRuby 1.6 and 1.7, and MRI 1.9. More testing is probably needed to make sure I didn't break anything.

I will create a pull request now.

from highline.

JEG2 avatar JEG2 commented on July 18, 2024

I've merged the changes. Thank you.

Anyone else willing to double-check this stuff before I release a new gem?

from highline.

ryanb avatar ryanb commented on July 18, 2024

@JEG2 I had the error mentioned in this issue and using the master branch fixed it. I will be mentioning this fix in a RailsCasts episode today but it would be nice to get a release soon. Thanks!

from highline.

JEG2 avatar JEG2 commented on July 18, 2024

I have pushed 1.6.14 with this fix. Thanks all!

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.