tweaks: rename a function, away from using an abbreviation

Also reshuffle a tiny fragment of code.
master
Benno Schulenberg 2021-11-17 11:01:37 +01:00
parent e35b6636ab
commit c772e1cb6b
4 changed files with 7 additions and 8 deletions

View File

@ -1512,7 +1512,7 @@ void shortcut_init(void)
#ifndef NANO_TINY #ifndef NANO_TINY
/* Return the textual description that corresponds to the given flag. */ /* Return the textual description that corresponds to the given flag. */
const char *flagtostr(int flag) const char *epithet_of_flag(int flag)
{ {
switch (flag) { switch (flag) {
case NO_HELP: case NO_HELP:

View File

@ -235,7 +235,7 @@ void help_init(void)
for (s = sclist; s != NULL; s = s->next) for (s = sclist; s != NULL; s = s->next)
if (s->func == do_toggle) if (s->func == do_toggle)
allocsize += strlen(_(flagtostr(s->toggle))) + onoff_len + 9; allocsize += strlen(_(epithet_of_flag(s->toggle))) + onoff_len + 9;
} }
#endif #endif
@ -303,7 +303,7 @@ void help_init(void)
for (s = sclist; s != NULL; s = s->next) for (s = sclist; s != NULL; s = s->next)
if (s->toggle && s->ordinal == counter) { if (s->toggle && s->ordinal == counter) {
ptr += sprintf(ptr, "%s\t\t %s %s\n", (s->menus & MMAIN ? s->keystr : ""), 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. */ /* Add a blank like between two groups. */
if (s->toggle == NO_SYNTAX) if (s->toggle == NO_SYNTAX)
ptr += sprintf(ptr, "\n"); ptr += sprintf(ptr, "\n");

View File

@ -1077,6 +1077,8 @@ void toggle_this(int flag)
case ZERO: case ZERO:
window_init(); window_init();
draw_all_subwindows(); draw_all_subwindows();
if (flag == ZERO)
return;
break; break;
case CONSTANT_SHOW: case CONSTANT_SHOW:
if (ISSET(ZERO) || LINES == 1) { if (ISSET(ZERO) || LINES == 1) {
@ -1114,9 +1116,6 @@ void toggle_this(int flag)
#endif #endif
} }
if (flag == ZERO)
return;
if (ISSET(STATEFLAGS) && !ISSET(ZERO) && (flag == AUTOINDENT || if (ISSET(STATEFLAGS) && !ISSET(ZERO) && (flag == AUTOINDENT ||
flag == BREAK_LONG_LINES || flag == SOFTWRAP)) { flag == BREAK_LONG_LINES || flag == SOFTWRAP)) {
if (ISSET(MINIBAR)) if (ISSET(MINIBAR))
@ -1131,7 +1130,7 @@ void toggle_this(int flag)
if (flag == NO_HELP || flag == NO_SYNTAX) if (flag == NO_HELP || flag == NO_SYNTAX)
enabled = !enabled; enabled = !enabled;
statusline(REMARK, "%s %s", _(flagtostr(flag)), statusline(REMARK, "%s %s", _(epithet_of_flag(flag)),
enabled ? _("enabled") : _("disabled")); enabled ? _("enabled") : _("disabled"));
} }
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */

View File

@ -323,7 +323,7 @@ functionptrtype interpret(int *keycode);
#endif #endif
int keycode_from_string(const char *keystring); int keycode_from_string(const char *keystring);
void shortcut_init(void); void shortcut_init(void);
const char *flagtostr(int flag); const char *epithet_of_flag(int flag);
/* Some functions in help.c. */ /* Some functions in help.c. */
#ifdef ENABLE_HELP #ifdef ENABLE_HELP