feedback: when the user types ^Z, say they can suspend nano with ^T^Z

Inspired-by: Sébastien Desreux <seb@h-k.fr>
master
Benno Schulenberg 2021-11-05 10:12:27 +01:00
parent d0c2c1e6b9
commit 11fec6f63c
3 changed files with 12 additions and 0 deletions

View File

@ -1335,6 +1335,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-T", 0, cut_till_eof, 0);
add_to_sclist(MEXECUTE, "^V", 0, cut_till_eof, 0);
add_to_sclist(MEXECUTE, "^Z", 0, do_suspend_void, 0);
add_to_sclist(MMAIN, "^Z", 0, suggest_ctrlT_ctrlZ, 0);
add_to_sclist(MMAIN, "M-D", 0, count_lines_words_and_characters, 0);
#else
add_to_sclist(MMAIN, "M-H", 0, do_help, 0);

View File

@ -212,6 +212,16 @@ bool in_restricted_mode(void)
return FALSE;
}
/* Say how the user can achieve suspension (when they typed ^Z). */
void suggest_ctrlT_ctrlZ(void)
{
#ifdef ENABLE_NANORC
if (first_sc_for(MMAIN, do_execute) && first_sc_for(MMAIN, do_execute)->keycode == 0x14 &&
first_sc_for(MEXECUTE, do_suspend_void) && first_sc_for(MEXECUTE, do_suspend_void)->keycode == 0x1A)
#endif
statusline(AHEM, _("To suspend, type ^T^Z"));
}
/* Make sure the cursor is visible, then exit from curses mode, disable
* bracketed-paste mode, and restore the original terminal settings. */
void restore_terminal(void)

View File

@ -386,6 +386,7 @@ void free_lines(linestruct *src);
void renumber_from(linestruct *line);
void print_view_warning(void);
bool in_restricted_mode(void);
void suggest_ctrlT_ctrlZ(void);
void finish(void);
void close_and_go(void);
void do_exit(void);