bug-readline
[Top][All Lists]
Advanced

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

[PATCH] ANYOTHERKEY in macro/variable dumps


From: Grisha Levit
Subject: [PATCH] ANYOTHERKEY in macro/variable dumps
Date: Thu, 3 Aug 2023 20:50:34 -0400

If a keymap shadows a function or macro binding, the dumping code will
print this as `\000', which is not correct if the output is reused as
input.

$ bind '"\e": "X"'; bind -s
"\e\000": "X"
$ bind -u undo; bind '"\e": undo'; bind -p | grep ': undo'
"\e\000": undo

Change _rl_get_keyname to represent this as a zero-length string.
---
diff --git a/lib/readline/bind.c b/lib/readline/bind.c
index a8b139f0..2cd6089f 100644
--- a/lib/readline/bind.c
+++ b/lib/readline/bind.c
@@ -2607,6 +2607,12 @@ _rl_get_keyname (int key)
       return keyname;
     }

+  if (c == ANYOTHERKEY)
+    {
+      keyname[0] = '\0';
+      return keyname;
+    }
+
   i = 0;
   /* Now add special prefixes needed for control characters.  This can
      potentially change C. */



reply via email to

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