commit 9e982f32832fb96ef4b4448d3f9252932b165872
parent 11fec6f63cbcaef7314ecf546571cd774b0d8d98
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 5 Nov 2021 15:44:38 +0100
tweaks: rename a function, for some contrast and to get rid of a suffix
Diffstat:
4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/global.c b/src/global.c
@@ -981,7 +981,7 @@ void shortcut_init(void)
N_("Refresh"), WITHORSANS(refresh_gist), TOGETHER, VIEW);
#endif
- add_to_funcs(do_suspend_void, MMAIN,
+ add_to_funcs(suspend_nano, MMAIN,
N_("Suspend"), WITHORSANS(suspend_gist), BLANKAFTER, VIEW);
#ifndef NANO_TINY
@@ -1105,7 +1105,7 @@ void shortcut_init(void)
add_to_funcs(cut_till_eof, MEXECUTE,
N_("Cut Till End"), WITHORSANS(cuttilleof_gist), BLANKAFTER, NOVIEW);
- add_to_funcs(do_suspend_void, MEXECUTE,
+ add_to_funcs(suspend_nano, MEXECUTE,
N_("Suspend"), WITHORSANS(suspend_gist), BLANKAFTER, VIEW);
}
#endif /* !NANO_TINY */
@@ -1334,7 +1334,7 @@ void shortcut_init(void)
#ifndef NANO_TINY
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(MEXECUTE, "^Z", 0, suspend_nano, 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
@@ -1483,7 +1483,7 @@ void shortcut_init(void)
#endif
#if defined(KEY_CANCEL) && defined(KEY_SUSPEND) && defined(KEY_SIC)
add_to_sclist((MMOST & ~MMAIN) | MYESNO, "", KEY_CANCEL, do_cancel, 0);
- add_to_sclist(MMAIN|MEXECUTE, "", KEY_SUSPEND, do_suspend_void, 0);
+ add_to_sclist(MMAIN|MEXECUTE, "", KEY_SUSPEND, suspend_nano, 0);
add_to_sclist(MMAIN, "", KEY_SIC, do_insertfile_void, 0);
#endif
#ifndef NANO_TINY
diff --git a/src/nano.c b/src/nano.c
@@ -212,15 +212,17 @@ bool in_restricted_mode(void)
return FALSE;
}
+#ifndef NANO_TINY
/* 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)
+ first_sc_for(MEXECUTE, suspend_nano) && first_sc_for(MEXECUTE, suspend_nano)->keycode == 0x1A)
#endif
statusline(AHEM, _("To suspend, type ^T^Z"));
}
+#endif
/* Make sure the cursor is visible, then exit from curses mode, disable
* bracketed-paste mode, and restore the original terminal settings. */
@@ -958,8 +960,8 @@ void do_suspend(int signal)
#endif
}
-/* Put nano to sleep. */
-void do_suspend_void(void)
+/* When permitted, put nano to sleep. */
+void suspend_nano(void)
{
if (in_restricted_mode())
return;
diff --git a/src/prototypes.h b/src/prototypes.h
@@ -386,7 +386,9 @@ void free_lines(linestruct *src);
void renumber_from(linestruct *line);
void print_view_warning(void);
bool in_restricted_mode(void);
+#ifndef NANO_TINY
void suggest_ctrlT_ctrlZ(void);
+#endif
void finish(void);
void close_and_go(void);
void do_exit(void);
@@ -402,6 +404,7 @@ void handle_hupterm(int signal);
void handle_crash(int signal);
#endif
void do_suspend(int signal);
+void suspend_nano(void);
void do_continue(int signal);
#if !defined(NANO_TINY) || defined(ENABLE_SPELLER) || defined(ENABLE_COLOR)
void block_sigwinch(bool blockit);
@@ -622,7 +625,6 @@ void spotlight(size_t from_col, size_t to_col);
#ifndef NANO_TINY
void spotlight_softwrapped(size_t from_col, size_t to_col);
#endif
-void do_suspend_void(void);
#ifdef ENABLE_EXTRA
void do_credits(void);
#endif
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -396,7 +396,7 @@ keystruct *strtosc(const char *input)
else if (!strcmp(input, "refresh"))
s->func = full_refresh;
else if (!strcmp(input, "suspend"))
- s->func = do_suspend_void;
+ s->func = suspend_nano;
else if (!strcmp(input, "casesens"))
s->func = case_sens_void;
else if (!strcmp(input, "regexp"))