[self-follow-up]

At 2026-07-04T17:30:40-0500, G. Branden Robinson wrote:
> At 2026-07-04T22:04:38+0000, Antonio Niño Díaz wrote:
> > I've done a few more tests. If I assign single characters to
> > ku/kd/kr/kl, like "ku=A", it works as expected (when I press A I get
> > a KEY_UP event). It's just multi-character strings that fail.
> > However, I have noticed that if I make it "ku=AA" it will hang
> > slightly after I press the first A (and then I just receive an A key
> > press event instead of KEY_UP because it hasn't seen a second A). So
> > I think that there may be some issue with some wait loop in
> > ncurses...
> 
> Your example established that you're using keypad mode.  Have you read
> the getch(3) man page?  What you are observing sounds exactly like what
> is documented there.

It occurs to me that you're using an unusual prefix for your key
assignments.  Almost all terminals use the escape character to begin a
multi-byte escape sequence; you're using "A".

The documentation is written assuming that the prefix is the escape
character, because that is the most common case.  But the disambiguation
procedure described in getch() under "Keypad Mode" applies to any
situation where an input key is a prefix of multiple key capabilities.

The delay occurs because keypad mode gathers key strokes until the input
can be disambiguated.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature

Reply via email to