nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 11fec6f63cbcaef7314ecf546571cd774b0d8d98
parent d0c2c1e6b99645038753716e8ef5ec0e45054f7b
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri,  5 Nov 2021 10:12:27 +0100

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

Inspired-by: Sébastien Desreux <seb@h-k.fr>

Diffstat:
Msrc/global.c | 1+
Msrc/nano.c | 10++++++++++
Msrc/prototypes.h | 1+
3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/global.c b/src/global.c @@ -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); diff --git a/src/nano.c b/src/nano.c @@ -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) diff --git a/src/prototypes.h b/src/prototypes.h @@ -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);