bindings: let M-& show the ncurses version+patch, as a small Easter egg

This commit is contained in:
Benno Schulenberg 2024-03-18 10:21:04 +01:00
parent fdd92af3ac
commit d77263d8ed

View File

@ -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);