inkytonik / kiama

A Scala library for language processing.
Mozilla Public License 2.0
47 stars 15 forks source link

Fix arrow behaviour in REPLs when using sbt 1.4.x #26

Open inkytonik opened 3 years ago

inkytonik commented 3 years ago

Since 2.4.0 it seems that back arrow moves the cursor backwards but erases the skipped-over character on the screen (but not in the input). This makes line editing basically impossible because you can't see what you are doing.

Reproduce with

extras/Test/runMain org.bitbucket.inkytonik.kiama.example.lambda.Lambda

then enter some text, back arrow over some of it. You will see spaces where the skipped-over characters should be.

inkytonik commented 3 years ago

Presumably related to JLIne. Move to JLine 3 while we're at it?

inkytonik commented 3 years ago

It seems that JLine3 causes more problems than it's worth. Also, sbt seems to still be on JLine2 for most Scala versions, so it's easier if we stay there too.

inkytonik commented 3 years ago

Ok, new information. If we run the Lambda program mentioned above outside sbt (i.e., by extracting the CLASSPATH and running java with that CLASSPATH directly), everything is fine. This suggests that the problem is due to interaction between sbt's use of JLine and Kiama's.

In Kiama 2.4.0 we are still using JLine2, but sbt as of 1.4.0 moved to JLine3. The approach that Kiama previously used to interoperate nicely with sbt is no longer working properly.

Ideally, we should move to JLine3 to get the latest and greatest, but also work out a way to make it interoperate with sbt again.

inkytonik commented 3 years ago

It seems that everything is ok on Linux (or at least one version of Linux). So maybe this is a Mac-specific thing.

inkytonik commented 3 years ago

A workaround is to stay with sbt 1.3.x which works fine with Kiama 1.4.0.

inkytonik commented 3 years ago

Using a backspace character (control-H) works fine.