commit bc09f0992efa68c574ce3ced5a3b769177011a0e
parent 00e2309987bcbaae8dbd56689844930a59b9069f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 8 Jun 2024 17:08:17 +0200
tweaks: reshuffle some lines, to put vaguely related things together
And to slightly reduce the number of #ifdefs.
Diffstat:
4 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/src/global.c b/src/global.c
@@ -580,6 +580,7 @@ void shortcut_init(void)
const char *replace_gist = N_("Replace a string or a regular expression");
const char *gotoline_gist = N_("Go to line and column number");
#ifndef NANO_TINY
+ const char *bracket_gist = N_("Go to the matching bracket");
const char *mark_gist = N_("Mark text starting from the cursor position");
const char *zap_gist = N_("Throw away the current line (or marked region)");
const char *indent_gist = N_("Indent the current line (or marked lines)");
@@ -606,23 +607,18 @@ void shortcut_init(void)
#ifndef NANO_TINY
const char *toprow_gist = N_("Go to first row in the viewport");
const char *bottomrow_gist = N_("Go to last row in the viewport");
+ const char *center_gist = N_("Center the line where the cursor is");
#endif
const char *prevpage_gist = N_("Go one screenful up");
const char *nextpage_gist = N_("Go one screenful down");
const char *firstline_gist = N_("Go to the first line of the file");
const char *lastline_gist = N_("Go to the last line of the file");
-#ifndef NANO_TINY
- const char *bracket_gist = N_("Go to the matching bracket");
-#endif
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
const char *scrollup_gist =
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
const char *prevfile_gist = N_("Switch to the previous file buffer");
const char *nextfile_gist = N_("Switch to the next file buffer");
diff --git a/src/move.c b/src/move.c
@@ -207,7 +207,15 @@ void to_bottom_row(void)
place_the_cursor();
}
-#endif
+
+/* Scroll the line with the cursor to the center of the screen. */
+void do_center(void)
+{
+ adjust_viewport(CENTERING);
+ draw_all_subwindows();
+ full_refresh();
+}
+#endif /* !NANO_TINY */
#ifdef ENABLE_JUSTIFY
/* Move to the first beginning of a paragraph before the current line. */
@@ -622,16 +630,6 @@ void do_scroll_down(void)
}
#endif /* !NANO_TINY || ENABLE_HELP */
-#ifndef NANO_TINY
-/* Scroll the line with the cursor to the center of the screen. */
-void do_center(void)
-{
- adjust_viewport(CENTERING);
- draw_all_subwindows();
- full_refresh();
-}
-#endif
-
/* Move left one character. */
void do_left(void)
{
diff --git a/src/prototypes.h b/src/prototypes.h
@@ -366,6 +366,7 @@ void do_page_down(void);
#ifndef NANO_TINY
void to_top_row(void);
void to_bottom_row(void);
+void do_center(void);
#endif
#ifdef ENABLE_JUSTIFY
void do_para_begin(linestruct **line);
@@ -387,9 +388,6 @@ void do_down(void);
void do_scroll_up(void);
void do_scroll_down(void);
#endif
-#ifndef NANO_TINY
-void do_center(void);
-#endif
void do_left(void);
void do_right(void);
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -322,6 +322,8 @@ keystruct *strtosc(const char *input)
s->func = do_undo;
else if (!strcmp(input, "redo"))
s->func = do_redo;
+ else if (!strcmp(input, "suspend"))
+ s->func = do_suspend;
#endif
else if (!strcmp(input, "left") ||
!strcmp(input, "back"))
@@ -389,10 +391,6 @@ keystruct *strtosc(const char *input)
s->func = do_backspace;
else if (!strcmp(input, "refresh"))
s->func = full_refresh;
-#ifndef NANO_TINY
- else if (!strcmp(input, "suspend"))
- s->func = do_suspend;
-#endif
else if (!strcmp(input, "casesens"))
s->func = case_sens_void;
else if (!strcmp(input, "regexp"))