Re: Bugs when porting ncurses to a new platform

"G. Branden Robinson" <[email protected]> Sat, 4 Jul 2026 18:05:40 -0500
Newsgroups gmane.comp.lib.ncurses.bugs
Message-ID <20260704230540.lvptji4ayye7zwz6@illithid>
--wmwr5mg4tilbzxgf
Content-Type: text/plain; protected-headers=v1; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Subject: Re: Bugs when porting ncurses to a new platform
MIME-Version: 1.0

[self-follow-up]

At 2026-07-04T17:30:40-0500, G. Branden Robinson wrote:
> At 2026-07-04T22:04:38+0000, Antonio Ni=F1o D=EDaz wrote:
> > I've done a few more tests. If I assign single characters to
> > ku/kd/kr/kl, like "ku=3DA", 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=3DAA" 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...
>=20
> 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

--wmwr5mg4tilbzxgf
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmpJkbkACgkQ0Z6cfXEm
bc7VpQ/8DuH0/PVUW2g3/I0Ilo+0p/ZSfAfP9wvSUBnTiW3GXf/BkG0R1nrd+tY2
NFwtf8crrD4dBvjVobcYAp0DJnTH4qELI/sUGE9fCSiJQUfykaiYK4147h/bersc
cyM5DCTyzrlDBHssrO5lhR7YYzUZ1vwhc9DhLDgDYm4dBXxUIfZ2YeQxDVc0LCsq
zBbzU+3Ujmk5BwDphAmlr2J4jhttY2B8nbh5Wqa577CLW+OpJSL04oZvGo01Z38o
d5bsAll4jZI/Ob4f45akHDqnw6ATQv8lCkXd4v9MVOeCpAhlngexYa1muTt6VxeM
MOhrbhgWQrULt+54xg3AXMIB0/zs/HwdP3Mc3161aGdYkTMK6Klv6rAWXKOZE7fE
s+jbLLihbbOi212pfarJqsq8QDWYsvuC1xYoLdqeMWB+FDXRtQ2QjngloQwFMxU/
3I+XWPBhWlmXjeaBNmY8bkRAME07I3Ywx29nnJXVY2h1+HTRq6gFSyKZDpVSOaxz
nKqDgATDGywBszRTOXas4BcSRsmIYxc/4v4tejIqfHd9t9397W6FKI+ZI7FPXheQ
/hTxSYkRHd/5stXF77/2+QJ49dX38vkmPbyZNqQ8Baj1SRphJNY6Pb3qJvnuGPUY
VATmitMPLv5S7qoQnhLfTqLV9M53sm/M67k38rNZw/SS/MhaoLU=
=JK15
-----END PGP SIGNATURE-----

--wmwr5mg4tilbzxgf--