On some platforms the numeric keypad is stuck in navigation mode (irrespective
of the NumLock state)[1]. I believe I've isolated the source of the problem
to libXt, specifically when it is compiled with Xkb support[2].
I've submitted a bug report to libXt but there are a few ways to work around
or fix this issue in nedit[3]:
1) Work-around: Run nedit using XKB_DISABLE=1 nedit
2) Temporary fix: Edit nedit.c and insert the following line immediately
before the TheDisplay = XtOpenDisplay(...) call:
putenv("XKB_DISABLE=1");
Note that either of these effectively disables Xkb support so may have
knock-on effects.
3) Proper fix: Correct the issue in libXt (assuming the problem actually lies
there). This is outside the scope of this bug report.
Links to related bug reports:
[1] Except for the 5 key which does follow NumLock. This was first observed
by myself on Ubuntu 22.04 (jammy).
[2] The problem seems to lie in libXt’s XtTranslateKey(...) function (in
src/TMkey.c). When compiled with Xkb support this simply makes a call to
XkbLookupKeySym(...) and does no further processing. I believe that what it
should be doing is then processing the returned “list of modifiers that should
still be applied” (per the XkbLookupKeySym(3) manpage).
[3] There are suggestions that running setxkbmap -option numpad:mac will
fix the problem however I found that this works only occasionally, temporarily,
and inconsistently.
Related: Link to
xneditbug reportIt turns out that this was fixed in a newer version of
xneditand that fix also works fornedit. I still think the underlying issue is inlibXtbut this fix works and that's what matters.The attached patch fixes the issue for
nedit. The suggestions I made in my initial bug report should be ignored.Credit goes to Olaf Wintermann for the fix in
xneditthat this patch is based on.