From 00e2309987bcbaae8dbd56689844930a59b9069f Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 8 Jun 2024 15:27:10 +0200 Subject: [PATCH] tweaks: make the inclusion condition for do_center() more strict There is no reason why --enable-help should cause the centering function to be included in a tiny version. --- src/global.c | 6 ++++-- src/move.c | 4 +++- src/prototypes.h | 2 ++ src/rcfile.c | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/global.c b/src/global.c index 9c6b1e66..5c199409 100644 --- a/src/global.c +++ b/src/global.c @@ -619,6 +619,8 @@ void shortcut_init(void) N_("Scroll up one line without moving the cursor textually"); const char *scrolldown_gist = N_("Scroll down one line without moving the cursor textually"); +#endif +#ifndef NANO_TINY const char *center_gist = N_("Center the line where the cursor is"); #endif #ifdef ENABLE_MULTIBUFFER @@ -1079,7 +1081,7 @@ void shortcut_init(void) add_to_funcs(full_refresh, MMAIN, N_("Refresh"), WHENHELP(refresh_gist), TOGETHER); #endif -#if !defined(NANO_TINY) || defined(ENABLE_HELP) +#ifndef NANO_TINY add_to_funcs(do_center, MMAIN, N_("Center"), WHENHELP(center_gist), BLANKAFTER); #endif @@ -1430,7 +1432,7 @@ void shortcut_init(void) add_to_sclist(MMAIN, "M-J", 0, do_full_justify, 0); add_to_sclist(MEXECUTE, "^J", 0, do_full_justify, 0); #endif -#if !defined(NANO_TINY) || defined(ENABLE_HELP) +#ifndef NANO_TINY add_to_sclist(MMAIN, "^L", 0, do_center, 0); #endif add_to_sclist(MMOST|MBROWSER|MHELP|MYESNO, "^L", 0, full_refresh, 0); diff --git a/src/move.c b/src/move.c index 5d834328..8180928d 100644 --- a/src/move.c +++ b/src/move.c @@ -620,7 +620,9 @@ void do_scroll_down(void) )) edit_scroll(FORWARD); } +#endif /* !NANO_TINY || ENABLE_HELP */ +#ifndef NANO_TINY /* Scroll the line with the cursor to the center of the screen. */ void do_center(void) { @@ -628,7 +630,7 @@ void do_center(void) draw_all_subwindows(); full_refresh(); } -#endif /* !NANO_TINY || ENABLE_HELP */ +#endif /* Move left one character. */ void do_left(void) diff --git a/src/prototypes.h b/src/prototypes.h index 55ab21c1..312442fb 100644 --- a/src/prototypes.h +++ b/src/prototypes.h @@ -386,6 +386,8 @@ void do_down(void); #if !defined(NANO_TINY) || defined(ENABLE_HELP) void do_scroll_up(void); void do_scroll_down(void); +#endif +#ifndef NANO_TINY void do_center(void); #endif void do_left(void); diff --git a/src/rcfile.c b/src/rcfile.c index 9e80c1da..9ecc89fc 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -340,8 +340,6 @@ keystruct *strtosc(const char *input) s->func = do_scroll_up; else if (!strcmp(input, "scrolldown")) s->func = do_scroll_down; - else if (!strcmp(input, "center")) - s->func = do_center; #endif else if (!strcmp(input, "prevword")) s->func = to_prev_word; @@ -360,6 +358,8 @@ keystruct *strtosc(const char *input) s->func = to_top_row; else if (!strcmp(input, "bottomrow")) s->func = to_bottom_row; + else if (!strcmp(input, "center")) + s->func = do_center; #endif else if (!strcmp(input, "pageup") || !strcmp(input, "prevpage"))