Open ForNeVeR opened 6 years ago
#D13B0B
or LightGoldenRodYellow
do not mean a thing for a terminal. Rot.js has some facility to map weird HTML stuff onto ANSI colors, but it's not available in the JVM world.Regarding the color and input stuff: probably take a look at lanterna, that's a library offering some nice abstractions around terminals.
It somewhat lacked proper Windows support last time I looked, but I could hack it.
I've already dropped in lanterna while implementing terminal support and did some preliminary research on unborking windows terminals, so I'm way ahead on this. Guess I'll do something with colors while finishing #5.
(tldr on terminals in Windows is that they are messed up beyond belief because of historical reasons. lanterna does works ok in a cygwin terminal and has an AWT terminal emulation mode)
Well, starting from some stupid version of Windows 10 it should work much better. I think we should support that mode. To enable that shit, we should call SetConsoleMode
with ENABLE_VIRTUAL_TERMINAL_PROCESSING
. Here're docs. I think it should be worth to enable these shits in lanterna.
Not exactly, no. The thing is, lanterna does not have any Windows support to speak of. If it runs in a cygwin environment, it sort of works. If one tries to start it in a cmd
window, it still tries to run like that and crashes trying to run stty.exe
.
I guess there's a possibility of dropping in our own implementation based on com.googlecode.lanterna.terminal.ansi.ANSITerminal
. Lanterna does looks for com.googlecode.lanterna.terminal.WindowsTerminal
in classpath and tries to use it before falling back to Cygwin. I'm not exactly jumping at the thought of calling WinAPI from inside JVM here though.
The thing is, lanterna does not have any Windows support to speak of.
Well, yeah, mainstream lanterna doesn't. But some time ago I was working on a branch where it is. If there is a necessity, then we'll be able to dust it out.
I'm not exactly jumping at the thought of calling WinAPI from inside JVM here though.
Heh, but I am!
(Probably linked with #5)
Currently, the platform abstraction layer is nearly-nonexistent. We need to make an isolated place for all of the platform-dependent things (e.g. key codes,
Display
implementation etc.), so that we have a definitive answer to the question "How do I add the new platform".