nano

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

commit c772e1cb6b8ccd2e8e4f831e13e627a599e8b06b
parent e35b6636abf9a3687f7ce01d29e51b8cdb87f2d2
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 17 Nov 2021 11:01:37 +0100

tweaks: rename a function, away from using an abbreviation

Also reshuffle a tiny fragment of code.

Diffstat:
Msrc/global.c | 2+-
Msrc/help.c | 4++--
Msrc/nano.c | 7+++----
Msrc/prototypes.h | 2+-
4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/global.c b/src/global.c @@ -1512,7 +1512,7 @@ void shortcut_init(void) #ifndef NANO_TINY /* Return the textual description that corresponds to the given flag. */ -const char *flagtostr(int flag) +const char *epithet_of_flag(int flag) { switch (flag) { case NO_HELP: diff --git a/src/help.c b/src/help.c @@ -235,7 +235,7 @@ void help_init(void) for (s = sclist; s != NULL; s = s->next) if (s->func == do_toggle) - allocsize += strlen(_(flagtostr(s->toggle))) + onoff_len + 9; + allocsize += strlen(_(epithet_of_flag(s->toggle))) + onoff_len + 9; } #endif @@ -303,7 +303,7 @@ void help_init(void) for (s = sclist; s != NULL; s = s->next) if (s->toggle && s->ordinal == counter) { ptr += sprintf(ptr, "%s\t\t %s %s\n", (s->menus & MMAIN ? s->keystr : ""), - _(flagtostr(s->toggle)), _("enable/disable")); + _(epithet_of_flag(s->toggle)), _("enable/disable")); /* Add a blank like between two groups. */ if (s->toggle == NO_SYNTAX) ptr += sprintf(ptr, "\n"); diff --git a/src/nano.c b/src/nano.c @@ -1077,6 +1077,8 @@ void toggle_this(int flag) case ZERO: window_init(); draw_all_subwindows(); + if (flag == ZERO) + return; break; case CONSTANT_SHOW: if (ISSET(ZERO) || LINES == 1) { @@ -1114,9 +1116,6 @@ void toggle_this(int flag) #endif } - if (flag == ZERO) - return; - if (ISSET(STATEFLAGS) && !ISSET(ZERO) && (flag == AUTOINDENT || flag == BREAK_LONG_LINES || flag == SOFTWRAP)) { if (ISSET(MINIBAR)) @@ -1131,7 +1130,7 @@ void toggle_this(int flag) if (flag == NO_HELP || flag == NO_SYNTAX) enabled = !enabled; - statusline(REMARK, "%s %s", _(flagtostr(flag)), + statusline(REMARK, "%s %s", _(epithet_of_flag(flag)), enabled ? _("enabled") : _("disabled")); } #endif /* !NANO_TINY */ diff --git a/src/prototypes.h b/src/prototypes.h @@ -323,7 +323,7 @@ functionptrtype interpret(int *keycode); #endif int keycode_from_string(const char *keystring); void shortcut_init(void); -const char *flagtostr(int flag); +const char *epithet_of_flag(int flag); /* Some functions in help.c. */ #ifdef ENABLE_HELP