Re: Bugs when porting ncurses to a new platform
Antonio Niño Díaz <[email protected]> Sat, 04 Jul 2026 09:39:26 +0000
| Newsgroups | gmane.comp.lib.ncurses.bugs |
|---|---|
| Message-ID | <HxIwCffB2skhceT-2yuMCFGH-UgWr2eom8rYemDQrETbKj4NFYgIuV0EF3xm3gY2ZzPwlXFJ8FTBuzauM_MZdGbAf6Q7dQloCnYERVyXAGM=@proton.me> |
Hi!
I've got this almost working, all I need to do right now is to inject speci=
al
key presses into the stdin buffer and let ncurses give me the right KEY_*
defines with getch(). Well, I also want to support mouse events, but that's
probably the same thing (adding more escape sequences to stdin).
I have added the following to my termcaps:
:ku=3D\E[A:\
:kd=3D\E[B:\
:kr=3D\E[C:\
:kl=3D\E[D:\
So that calling `has_key(KEY_UP)` and such returns 1.
Also, I've called the following from my test code:
keypad(stdscr, TRUE);
cbreak();
timeout(0);
Then, from my own keyboard driver, whenever I detect I've pressed "up" I ad=
d
the characters '\x1B', '[' and 'A' to the stdin buffer the same way I add a=
ny
other regular character (like 'g', '!', etc).
getch() works with regular characters (and with '\n') but it returns me
individual characters of the escape sequence instead of KEY_UP.
I've also noticed that if there is more than one character in my stdin buff=
er
ncurses won't behave as expected, so this may be a bug in my keyboard/stdin
driver. I'm just trying to rule out ncurses configuration issues.
Am I missing something?
Thanks,
Antonio