bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

first keycode is not correct when application uses own poll


From: Pavel Stehule
Subject: first keycode is not correct when application uses own poll
Date: Sun, 18 Jul 2021 10:57:24 +0200

Hi

I am author of pspg https://github.com/okbob/pspg, and I found strange behaviour of ncurses input processing when there is a specific situation. a) pspg is a pager, so I need to process an reading from two streams stdin and tty. For this purpose I use timeout(0) and my own poll. Almost every time I have an active keypad, but not always - for readline is necessary raw stream. So I have an active keypad on stdscr and disabled keypad on my  window that is used for editing.

Please, see file test-ncurses-bug

When I press key down as first event, I get result

          pressed "^[" (27)
          pressed "[" (91)
          pressed "B" (66)

instead

          pressed "KEY_DOWN" (258)

First event is not processed correctly.

Workaround is simple (but looks messy, and it was crazy to find this workaround) - just run again "workpad" function on stdscr

It is interesting, so without a mentioned workaround, the behaviour is fixed by self for next key's events.

Regards

Pavel

Attachment: test-ncurses-bug.c
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]