tweaks: rename two record elements and three parameters, for clarity

This commit is contained in:
Benno Schulenberg 2022-08-28 08:57:03 +02:00
parent cd9402075a
commit d0dc270eec
7 changed files with 17 additions and 18 deletions

View File

@ -639,14 +639,13 @@ typedef struct keystruct {
typedef struct funcstruct {
void (*func)(void);
/* The actual function to call. */
const char *desc;
/* The function's short description, for example "Where Is". */
const char *tag;
/* The function's help-line label, for example "Where Is". */
#ifdef ENABLE_HELP
const char *help;
/* The help-screen text for this function. */
const char *phrase;
/* The function's description for in the help viewer. */
bool blank_after;
/* Whether there should be a blank line after the help text
* for this function. */
/* Whether to distance this function from the next in the help viewer. */
#endif
int menus;
/* In what menus this function applies. */

View File

@ -57,7 +57,7 @@ void make_new_buffer(void)
openfile->next = newnode;
/* There is more than one buffer: show "Close" in help lines. */
exitfunc->desc = close_tag;
exitfunc->tag = close_tag;
more_than_one = !inhelp || more_than_one;
}
#endif
@ -627,7 +627,7 @@ void close_buffer(void)
/* When just one buffer remains open, show "Exit" in the help lines. */
if (openfile && openfile == openfile->next)
exitfunc->desc = exit_tag;
exitfunc->tag = exit_tag;
}
#endif /* ENABLE_MULTIBUFFER */

View File

@ -317,8 +317,8 @@ void discard_buffer(void) {;}
void do_cancel(void) {;}
/* Add a function to the linked list of functions. */
void add_to_funcs(void (*function)(void), int menus, const char *desc,
const char *help, bool blank_after)
void add_to_funcs(void (*function)(void), int menus, const char *tag,
const char *phrase, bool blank_after)
{
funcstruct *f = nmalloc(sizeof(funcstruct));
@ -331,9 +331,9 @@ void add_to_funcs(void (*function)(void), int menus, const char *desc,
f->next = NULL;
f->func = function;
f->menus = menus;
f->desc = desc;
f->tag = tag;
#ifdef ENABLE_HELP
f->help = help;
f->phrase = phrase;
f->blank_after = blank_after;
#endif
}

View File

@ -224,7 +224,7 @@ void help_init(void)
* plus translated text, plus one or two \n's. */
for (f = allfuncs; f != NULL; f = f->next)
if (f->menus & currmenu)
allocsize += strlen(_(f->help)) + 21;
allocsize += strlen(_(f->phrase)) + 21;
#ifndef NANO_TINY
/* If we're on the main list, we also count the toggle help text.
@ -282,7 +282,7 @@ void help_init(void)
ptr += 10;
/* The shortcut's description. */
ptr += sprintf(ptr, "%s\n", _(f->help));
ptr += sprintf(ptr, "%s\n", _(f->phrase));
if (f->blank_after)
ptr += sprintf(ptr, "\n");

View File

@ -480,7 +480,7 @@ void mouse_init(void)
#endif /* ENABLE_MOUSE */
/* Print the usage line for the given option to the screen. */
void print_opt(const char *shortflag, const char *longflag, const char *desc)
void print_opt(const char *shortflag, const char *longflag, const char *description)
{
int firstwidth = breadth(shortflag);
int secondwidth = breadth(longflag);
@ -493,7 +493,7 @@ void print_opt(const char *shortflag, const char *longflag, const char *desc)
if (secondwidth < 24)
printf("%*s", 24 - secondwidth, " ");
printf("%s\n", _(desc));
printf("%s\n", _(description));
}
/* Explain how to properly use nano and its command-line options. */

View File

@ -1348,7 +1348,7 @@ static void check_vitals_mapped(void)
if (f->func == vitals[v] && f->menus & inmenus[v]) {
if (first_sc_for(inmenus[v], f->func) == NULL) {
jot_error(N_("No key is bound to function '%s' in menu '%s'. "
" Exiting.\n"), f->desc, menu_to_name(inmenus[v]));
" Exiting.\n"), f->tag, menu_to_name(inmenus[v]));
die(_("If needed, use nano with the -I option "
"to adjust your nanorc settings.\n"));
} else

View File

@ -2484,7 +2484,7 @@ void bottombars(int menu)
if (index + 2 >= number)
thiswidth += COLS % itemwidth;
post_one_key(s->keystr, _(f->desc), thiswidth);
post_one_key(s->keystr, _(f->tag), thiswidth);
index++;
}