Op 25-09-2026 om 11:34 schreef Benno Schulenberg:
Op 25-09-2026 om 00:24 schreef Joe:
When I push the hyphen key on my number pad in nano, it says
"[ Unbound key ]". The other keys on the number pad work fine,
and the hyphen on the main part of my keyboard works fine.

I was going to say that on my only machine with a numpad, the
hyphen there works fine, but... that is only under Manjaro.

It malfunctions under Manjaro too, when using TERM=xterm-256color.
(Normally, there TERM is vte-256color, which isn't affected.)

Attached patch should fix the issue, for any affected terminal.

Joe, did I guess your surname right?


Benno
From 49f285d96578dee54b30e8335d4c82ae3054ce1c Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <[email protected]>
Date: Sun, 27 Sep 2026 11:29:11 +0200
Subject: [PATCH] input: recognize the operator keys from the numeric keypad

In May 2019 the terminfo descriptions of various xterms were changed:
  https://lists.gnu.org/archive/html/bug-ncurses/2019-05/msg00021.html

That change made the operator keys on the keypad return the special
symbols kpDIV, kpMUL, kpSUB and kpADD, instead of simply the relevant
ASCII characters (/, *, - and +).

This fixes https://savannah.gnu.org/bugs/?68718.
Indirectly-reported-by: Joe Adams <[email protected]>
---
 src/global.c     | 2 ++
 src/nano.c       | 4 ++++
 src/prototypes.h | 2 ++
 src/winio.c      | 6 ++++++
 4 files changed, 14 insertions(+)

diff --git a/src/global.c b/src/global.c
index 5f78c1c2e..61733f654 100644
--- a/src/global.c
+++ b/src/global.c
@@ -123,6 +123,8 @@ int altinsert, altdelete;
 int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
 #endif
 int mousefocusin, mousefocusout;
+int operatorslash, operatorstar;
+int operatorminus, operatorplus;
 
 #ifdef ENABLED_WRAPORJUSTIFY
 ssize_t fill = -COLUMNS_FROM_EOL;
diff --git a/src/nano.c b/src/nano.c
index 75b111534..fe9acf62b 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2500,6 +2500,10 @@ int main(int argc, char **argv)
 	mousefocusin = get_keycode("kxIN", FOCUS_IN);
 	mousefocusout = get_keycode("kxOUT", FOCUS_OUT);
 #endif
+	operatorslash = get_keycode("kpDIV", ERR);
+	operatorstar  = get_keycode("kpMUL", ERR);
+	operatorminus = get_keycode("kpSUB", ERR);
+	operatorplus  = get_keycode("kpADD", ERR);
 
 	/* Disable the type-ahead checking that ncurses normally does. */
 	typeahead(-1);
diff --git a/src/prototypes.h b/src/prototypes.h
index 1de24dd43..d676d094f 100644
--- a/src/prototypes.h
+++ b/src/prototypes.h
@@ -88,6 +88,8 @@ extern int shiftaltleft, shiftaltright;
 extern int shiftaltup, shiftaltdown;
 #endif
 extern int mousefocusin, mousefocusout;
+extern int operatorslash, operatorstar;
+extern int operatorminus, operatorplus;
 
 #ifdef ENABLED_WRAPORJUSTIFY
 extern ssize_t fill;
diff --git a/src/winio.c b/src/winio.c
index 0e68bce44..c975387fe 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1359,6 +1359,12 @@ int parse_kbinput(WINDOW *frame)
 		case KEY_FRESH:
 #endif
 			return ERR;    /* Ignore this keystroke. */
+
+		default:
+			if (keycode == operatorslash)  return '/';
+			if (keycode == operatorstar)   return '*';
+			if (keycode == operatorminus)  return '-';
+			if (keycode == operatorplus)   return '+';
 	}
 
 	return keycode;
-- 
2.55.0

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to