3 ms·
I have looked into this in the past, and have always felt discouraged by the lack of good support for modern keyboards and mice. With ncurses and similar, you c
by gonzus 5y ago
I have looked into this in the past, and have always felt discouraged by the lack of good support for modern keyboards and mice. With ncurses and similar, you can only detect (a subset of) keys modified by Ctrl and Alt; I would like a portable way of finding about multiple combinations of modifiers, with any key in the keyboard, including function keys, home, end, up, down, etc. Ideally, I would also like to detect mouse events (including "window" clicked position) and even mouse events when holding Ctrl, Alt, etc. And I would like to do all this without having to parse multiple escape codes, implement timers or whatnot.
https://sw.kovidgoyal.net/kitty/keyboard-protocol/ https://sw.kovidgoyal.net/kitty/keyboard-protocol/ is a very promising step on this direction. Maybe next time I have to work on a TUI I will look into it.
- randomswede 5y agoI think part of it is that what good is your TUI if it doesn't work with, you know, a terminal, hooked up on a serial port? Where you will be unable to have anything but "shifted" and "control" characters easily recognisable. Some terminals did have a "meta"-equivalent key that simply forced the highest bit on, making them INSTANTLY incompatible with anything but US ASCII. Sure, you can write a TUI library that allows you to interact with "idealised terminal of choice", but I'd prefer one that works with one of the serial terminals I actually have, somewhere, around the place.