Comments (22)
JRuby moved from jline1 to jline2.7 on April 17 (jruby/jruby@bb7dc31)
I suppose highline is expecting jline1
from highline.
I would love to see this fixed. Anyone who know's jline and offers up a patch is my hero.
from highline.
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.
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.
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.
Wow, thanks for working on this.
I agree with you assessment. Let's bump line over ncurses.
from highline.
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.
Hmm, we probably need an option for older JRuby versions. Thoughts?
from highline.
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.
You could distinguish the jruby versions using JRUBY_VERSION, and keep the jline1 code around for < 1.7.
from highline.
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.
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.
It's looking good to me. I think you're on the right track.
from highline.
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.
Great. So we just need to sort out the backwards compatibility issues and these changes are a go.
from highline.
@tomdz's solution makes sense. Otherwise, you could try to require one, rescue the exception, and then try to require the other.
from highline.
Yeah, we just need someone to get the patch ready.
from highline.
@mnzaki - Just tested your branch as well. Worked a charm (was having exactly the same issue). Thanks for putting in the effort.
from highline.
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.
I've merged the changes. Thank you.
Anyone else willing to double-check this stuff before I release a new gem?
from highline.
@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.
I have pushed 1.6.14 with this fix. Thanks all!
from highline.
Related Issues (20)
- Proc validation displays ruby object on invalid HOT 8
- Incosistent behavior when ask with a validator and readline=true HOT 9
- undefined method 'default_instance' HOT 3
- Default Highline Example on GithubGives Error HOT 5
- HighLine Terminal::IOConsole#restore_mode does not work with StringIO HOT 3
- System extensions depend on now-internalized JRuby dependencies HOT 14
- consider exposing Readline.completion_proc via HighLine::Question#selection HOT 3
- default value has to be a string HOT 14
- Ctrl-C improperly handled when q.echo = false HOT 6
- Issues with echo: false and not on TTY HOT 7
- Can't get terminal_size HOT 11
- echo=false or echo='*' requires extra character after enter on Windows HOT 6
- Possible to accept multiple selections with `.in` and `.default`? HOT 5
- test failing when ruby is built against libedit instead of readline HOT 3
- Have to set convert type in order for `.in` to work with array
- 2.1.0 was released, but tag is missing in repository HOT 2
- Make Highline Ruby 3.3 and reline compatible HOT 1
- Update tests for Reline (as the substitute of Readline)
- Add `abbrev` to gemspec HOT 2
- `ask()` causes `Readline`-related error on Ruby 3.3 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from highline.