commit d77263d8ed2684a9d14d561928ed892d4aa93d5c
parent fdd92af3ac36552889b2fc52c958acca4412a478
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 18 Mar 2024 10:21:04 +0100
bindings: let M-& show the ncurses version+patch, as a small Easter egg
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/global.c b/src/global.c
@@ -388,6 +388,14 @@ int keycode_from_string(const char *keystring)
return -1;
}
+#if defined(ENABLE_EXTRA) && defined(NCURSES_VERSION_PATCH)
+void show_curses_version(void)
+{
+ statusline(INFO, "ncurses-%i.%i, patch %li", NCURSES_VERSION_MAJOR,
+ NCURSES_VERSION_MINOR, NCURSES_VERSION_PATCH);
+}
+#endif
+
/* Add a key combo to the linked list of shortcuts. */
void add_to_sclist(int menus, const char *scstring, const int keycode,
void (*function)(void), int toggle)
@@ -1540,6 +1548,9 @@ void shortcut_init(void)
#ifdef ENABLE_SPELLER
add_to_sclist(MMAIN, "F12", KEY_F(12), do_spell, 0);
#endif
+#if defined(ENABLE_EXTRA) && defined(NCURSES_VERSION_PATCH)
+ add_to_sclist(MMAIN, "M-&", 0, show_curses_version, 0);
+#endif
#ifndef NANO_TINY
add_to_sclist((MMOST & ~MMAIN) | MYESNO, "", KEY_CANCEL, do_cancel, 0);
add_to_sclist(MMAIN, "", KEY_SIC, do_insertfile, 0);