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

Need of a second keystroke to enter right square bracket in the REPL #8759

Closed
scabug opened this issue Jul 30, 2014 · 20 comments
Closed

Need of a second keystroke to enter right square bracket in the REPL #8759

scabug opened this issue Jul 30, 2014 · 20 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jul 30, 2014

HI,
it seems to be a regression issue:

Since 2.11.2, if i want to enter a right square bracket "]" in the REPL i need to press the left square bracket key (AltGr-8) first and then the right square bracket key (AltGr-9) afterwards on my german keyboard.
I encountered this first in 2.11.2, the versions before were not affected.

@scabug
Copy link
Author

scabug commented Jul 30, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8759?orig=1
Reporter: Marcello Presulli (marc)
Affected Versions: 2.11.2

@scabug
Copy link
Author

scabug commented Jul 30, 2014

@adriaanm said:
Scala 2.11.2 moved to jline 2.12 from jline 2.11 (both official releases of jline), so it must be some regression upstream. Could you please file this bug on their tracker? It seems it may be this one: jline/jline2#156

@scabug
Copy link
Author

scabug commented Jul 30, 2014

@adriaanm said:
As a workaround, you can manually replace the jline-2.12.jar in the lib/ directory of your scala distribution with a version of jline that doesn't have this bug (2.11, presumably).

@scabug
Copy link
Author

scabug commented Aug 8, 2014

@bjornregnell said:
I have the same problem with my Swedish keyboard. This makes the REPL pretty useless for those with AltGR bracket layouts. The suggested workaround changing to the jline-2.11.jar in scala/lib worked fine. Maybe you should go back to distribute jline-2.11 instead until this severe bug is fixed? -- After all type annotations are kind of important in Scala ;)

@scabug
Copy link
Author

scabug commented Aug 9, 2014

@paulp said:
A less intrusive workaround than manually replacing the jar is

scala -J-Xbootclasspath/p:$HOME/.ivy2/cache/jline/jline/jars/jline-2.11.jar

@scabug
Copy link
Author

scabug commented Aug 9, 2014

@bjornregnell said:
Aah. Thanks! I still think this is such a severe regression that Scala should be distributed with good old jline-2.11 until its fixed. This bug will give Scala a flaky appearance to newcomers trying out Scala in the REPL for the first time, and many of those might not manage to dig deep enough to find the workarounds...

@scabug
Copy link
Author

scabug commented Jan 4, 2015

@michael72 said:
I just ran on the same issue. This bug was closed with the resolution "out of scope", but since the reason for this problem is a bug in a used library, why don't you just go back and use the jline version (obviously 2.11) that doesn't contain this bug in the first place until the bug has been fixed in some version 2.xx. Besides it is nice that the same bug has been posted on github/jiline2 to be fixed, but since there hasn't been any activity on this project for the last 7 months, it is very unlikely the bug will be fixed at all.

So if there is no evident reason for scala REPL to use jline-2.12, please switch back to the working version or don't use jiline at all. Otherwise every user of scala REPL who uses keyboards with Alt-Gr key combinations will run into the same problem. Other than that simply pasting some code into REPL does not work for me when [ ] or @ is contained.

@scabug
Copy link
Author

scabug commented Jan 5, 2015

@bjornregnell said:
Yes, this is big remaining problem that hits me repeatedly! I am helping many newcomers to discover Scala here at Lund University in Sweden, and this bug unfortunately gives the false impression to newcomers that Scala is unstable and unfinished. I repeatedly help newbies to replace the jline 2.12 jar with 2.11 in the right folder buried in their Scala installation... Going back to jline-2.11 for coming releases of Scala seems like a perfect and easy solution! The sooner the better. That would help newcomers to get the right impression of the fantastic Scala tools. I have no issues with jline 2.11, so AFAIK it should be a simple switch.

@scabug
Copy link
Author

scabug commented Jan 21, 2015

@adriaanm said (edited on Jan 21, 2015 6:59:07 AM UTC):
I sympathize, but the upgrade to jline 2.12 was motivated by the issues collected under #8595, so, reverting to 2.11 would upset other users. I apologize for the inconvenience, but we're caught between two mythological unpleasant places, as they say. Ideally, jline would fix the upstream issue (jline/jline2#156), and we'd upgrade again. If someone has a patch for jline, we'd also be willing to consider upgrading to that custom version, but, in reality, the core team can't afford to maintain forks of our dependencies ourselves.

@scabug
Copy link
Author

scabug commented Jan 21, 2015

@michael72 said:
@adriaan: you're right, that certainly is a problem. Although it seems that issue #8644 was filed for the newer jiline, not for the older version - this is the bug concerning "paste" which I also have, when using jiline 2.12 (specifically paste does not work, when '[' is contained in the code). So basically it's only the arrow keys which did not work under some circumstances for 2.11 vs. copy/paste and generally inserting square brackets using 2.12. I don't know, I would feel the latter is worse, but it can be annoying as well when the arrow keys don't work. I agree with Bjorn's statements here that these bugs really make a bad impression on newbies using Scala.

@scabug
Copy link
Author

scabug commented Jan 21, 2015

@michael72 said:
I made some research and maybe found the problem - the original request was to use "Alt"-Key sequences in the editor:
jline/jline2#144
to support any Alt-Key sequences mentioned here:
http://en.wikipedia.org/wiki/C0_and_C1_control_codes#C1_set
Unfortunately the implementation does not seem to distinguish between the "Alt" and the "Alt Gr" key. The Alt-Gr key however is used on some non-US keyboards for inserting square brackets, the @-symbol, curly braces, etc.
jline/jline2@22b3a2d
So we get some fine Escape-sequences when inserting square brackets (or @) on some keyboards.

@scabug
Copy link
Author

scabug commented Jan 21, 2015

@michael72 said:
OK, I added a pull request to fix this bug at jline:
jline/jline2#175
with this change:
https://github.com/michael72/jline2/commit/645b851781de4f01d60ea1f7a2771465e16bf269

I tested it - it works for me :)
So, hopefully someone from the jline team will create a new release soon (although the project activity the last few months does not look like that)

@scabug
Copy link
Author

scabug commented Jan 21, 2015

@bjornregnell said:
Many thanks for addressing this issue Michael and Adrian!! Is there something else than hope that can applied to push jline ahead?

@scabug
Copy link
Author

scabug commented Jan 22, 2015

@adriaanm said:
Thanks, Michael! Very excited to see the power of OSS at work :-)
We'll keep pinging jline to publish a release before 2.11.6. Absolute worst case, we'll ship with a scala-private release that includes Michael's fix, although I hope it won't come to that.

@scabug
Copy link
Author

scabug commented Feb 10, 2015

@adriaanm said:
jline 2.12.1 with this fix was just staged: https://oss.sonatype.org/content/repositories/jline-1001/jline/jline/2.12.1/
(jline/jline2#175 (comment))

Hopefully this resolves the issue. We'll bump the version as soon as it hits maven central.

@scabug
Copy link
Author

scabug commented Feb 12, 2015

@adriaanm said:
I misunderstood, the JLine maintainers are waiting for us to confirm their staged version works. @bjornregnell or @michael72, could you give jline 2.12.1 a whirl and let them know whether it works so they can release, and we can bump the version in time for 2.11.6? Thanks!

@scabug
Copy link
Author

scabug commented Feb 12, 2015

@bjornregnell said:
Just tested it and it works fine with [ ] on a swedish keyboard on a win7 box.
Thumbs up!

@scabug
Copy link
Author

scabug commented Feb 12, 2015

@michael72 said:
OK - I successfully tested the 2.12.1 version from sonatype and posted a comment at jline repo as well.

@scabug
Copy link
Author

scabug commented Feb 12, 2015

@adriaanm said:
scala/scala#4324

@scabug
Copy link
Author

scabug commented Feb 13, 2015

@adriaanm said:
Fixed upstream in jline 2.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants