Is there a multiplatform TTY library? I can of cou...
# multiplatform
l
Is there a multiplatform TTY library? I can of course use ncurses from kotlin native, but I'd like something that also works on the JVM.
j
What capabilities do you need?
Or just regular-ass Mosaic for very high level
l
Not much. I need to be able to put characters are specific locations, read the keyboard, etc.
If there are ways to draw windows, menus etc, that'd be good too, so I don't have to implement all of that myself.
j
So Mosaic will someday get there. The medium-level library above does keyboard input and mouse input and all that perfectly fine. The high-level library doesn't fully expose all that just yet. There is a keyboard input modifier but no focus manager nor equivalent of a text field that automatically renders keypresses. And mouse support is not exposed at all yet.
l
Interesting. You don't seem to do any termlib integration yet?
j
I'm not sure what you mean by that
l
Termlib is the database of terminal definitions so you can send the correct control codes.
Oops, sorry. Terminfo
j
Ah, correct. It's entirely a capability-based system through interactive queries.
l
I'm not really familiar with compose, but I'm looking at the sample code, and it looks declarative, is this correct?
j
Yes
Btw I do use the
XTGETTCAP
control sequence to query terminfo, but I do not talk to the library directly myself.
l
Is there a way to define, say, a menu and then call a function saying "draw this menu and return the value selected"?
j
Someone would have to build that as a high-level component
I don't really have the time to work at that layer yet
l
Are there low level functions that does something like "go to line 5, col 3" and "draw a character with a certain colour"?
You can render anything you want at the declarative layer. There just aren't reusable high-level components that correspond to something like a "menu" or "window"
l
Oh I see. I can use this as a low level primitive and create my menus from there.
OK, this may actually be a solution to my problem right now. I'll try to build something with it. I want to add some text-based user interface components for my programming language interpreter. Like a viewer for tabular data for example. The idea is that you can call it from the language to display information.
d
Two other libraries I'm aware of that you may want to look at -- multiplatform console functionality but not full UI solutions like curses -- are mordant and (my own) kotter.
🚀 1
l
Thanks. I'll take a look. Right now I'm trying to integrate mosaic in my product 🙂
Rather, 'project'. It's open source.
Thanks
Last time I actually implemented a TTY-based UI for an application was... hmm... around 1995 I think.
d
Niiiiiice