8

I know about readInt and readLine similar methods for reading input from the keyboard and am able to populate variables with the data typed by the user. But in the REPL nothing is displayed when the characters are being typed. Is there a setting in the REPL to make them visible? Or should I use some other way of reading input from the user?

Gigatron
  • 1,995
  • 6
  • 20
  • 27
  • @om-nom-nom - That doesn't show you what you're typing, only what you've typed after you press enter (when it's presumably too late). – Rex Kerr Mar 09 '13 at 00:21
  • If I take a class file that was compiled from Scala code and run it using `java.exe`, the characters are visible as I type, without having to write code to display them. The completed application will be run with `java.exe`, so I don't want to write code for this only because of the behavior of the REPL. – Gigatron Mar 09 '13 at 00:33
  • I think the Scala REPL (still) uses JLine. You can probably dig around in the REPL source and find out how to get to the relevant objects and call the right method to alter the input behavior. ... I hope that's vague enough for you... – Randall Schulz Mar 09 '13 at 00:46

1 Answers1

10

I'm surprised this hasn't been answered yet. I ran into the same problem awhile back. Try running the REPL like this:

C:\> scala -Xnojline

This should disable JLine and allow you to use the readLine method the way you would expect (displaying characters typed as you type them).

KChaloux
  • 3,918
  • 6
  • 37
  • 52