Let's collect resources as a first thing:
- Scurses and jline3 are good places where to find informations
- Ansi Escape Code from wikipedia.
- Eugene wrote an interesting post about console games/escape codes: http://eed3si9n.com/console-games-in-scala
- We'll need to investigate about what a tty exactly is, if there are terminal emulators that are not ttys, which and where escape codes are supported, etc...
- It seems like we have two basic problems. Using ansi escape sequences, which should work out of the box for all platforms, and setting the terminal mode, which will vary a lot depending on the platform.
Interacting with terminal I/O interfaces will be the part of the project that will need code for different operating systems.
On Posix systems, terminal input can be interacted with via the C library termios.h. There is already bindings for this library in Scala Native. Here is a code sample from Java interacting with termios.h on the JVM through JNA.
It appears that the library needed to interop with windows terminals is msvcrt.dll, based on the previously mentioned Java snippet that works from the JVM.
We might also be able to use this: Windows Console Documentation Inside the windows console
There are some APIs in Scala Native, they seem incomplete:
For Scala.js interop, there is a node library for interacting with a console: https://nodejs.org/api/tty.html