tweaks: rename two record elements and three parameters, for clarity
This commit is contained in:
parent
cd9402075a
commit
d0dc270eec
@ -639,14 +639,13 @@ typedef struct keystruct {
|
|||||||
typedef struct funcstruct {
|
typedef struct funcstruct {
|
||||||
void (*func)(void);
|
void (*func)(void);
|
||||||
/* The actual function to call. */
|
/* The actual function to call. */
|
||||||
const char *desc;
|
const char *tag;
|
||||||
/* The function's short description, for example "Where Is". */
|
/* The function's help-line label, for example "Where Is". */
|
||||||
#ifdef ENABLE_HELP
|
#ifdef ENABLE_HELP
|
||||||
const char *help;
|
const char *phrase;
|
||||||
/* The help-screen text for this function. */
|
/* The function's description for in the help viewer. */
|
||||||
bool blank_after;
|
bool blank_after;
|
||||||
/* Whether there should be a blank line after the help text
|
/* Whether to distance this function from the next in the help viewer. */
|
||||||
* for this function. */
|
|
||||||
#endif
|
#endif
|
||||||
int menus;
|
int menus;
|
||||||
/* In what menus this function applies. */
|
/* In what menus this function applies. */
|
||||||
|
|||||||
@ -57,7 +57,7 @@ void make_new_buffer(void)
|
|||||||
openfile->next = newnode;
|
openfile->next = newnode;
|
||||||
|
|
||||||
/* There is more than one buffer: show "Close" in help lines. */
|
/* 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;
|
more_than_one = !inhelp || more_than_one;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -627,7 +627,7 @@ void close_buffer(void)
|
|||||||
|
|
||||||
/* When just one buffer remains open, show "Exit" in the help lines. */
|
/* When just one buffer remains open, show "Exit" in the help lines. */
|
||||||
if (openfile && openfile == openfile->next)
|
if (openfile && openfile == openfile->next)
|
||||||
exitfunc->desc = exit_tag;
|
exitfunc->tag = exit_tag;
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_MULTIBUFFER */
|
#endif /* ENABLE_MULTIBUFFER */
|
||||||
|
|
||||||
|
|||||||
@ -317,8 +317,8 @@ void discard_buffer(void) {;}
|
|||||||
void do_cancel(void) {;}
|
void do_cancel(void) {;}
|
||||||
|
|
||||||
/* Add a function to the linked list of functions. */
|
/* Add a function to the linked list of functions. */
|
||||||
void add_to_funcs(void (*function)(void), int menus, const char *desc,
|
void add_to_funcs(void (*function)(void), int menus, const char *tag,
|
||||||
const char *help, bool blank_after)
|
const char *phrase, bool blank_after)
|
||||||
{
|
{
|
||||||
funcstruct *f = nmalloc(sizeof(funcstruct));
|
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->next = NULL;
|
||||||
f->func = function;
|
f->func = function;
|
||||||
f->menus = menus;
|
f->menus = menus;
|
||||||
f->desc = desc;
|
f->tag = tag;
|
||||||
#ifdef ENABLE_HELP
|
#ifdef ENABLE_HELP
|
||||||
f->help = help;
|
f->phrase = phrase;
|
||||||
f->blank_after = blank_after;
|
f->blank_after = blank_after;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -224,7 +224,7 @@ void help_init(void)
|
|||||||
* plus translated text, plus one or two \n's. */
|
* plus translated text, plus one or two \n's. */
|
||||||
for (f = allfuncs; f != NULL; f = f->next)
|
for (f = allfuncs; f != NULL; f = f->next)
|
||||||
if (f->menus & currmenu)
|
if (f->menus & currmenu)
|
||||||
allocsize += strlen(_(f->help)) + 21;
|
allocsize += strlen(_(f->phrase)) + 21;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* If we're on the main list, we also count the toggle help text.
|
/* If we're on the main list, we also count the toggle help text.
|
||||||
@ -282,7 +282,7 @@ void help_init(void)
|
|||||||
ptr += 10;
|
ptr += 10;
|
||||||
|
|
||||||
/* The shortcut's description. */
|
/* The shortcut's description. */
|
||||||
ptr += sprintf(ptr, "%s\n", _(f->help));
|
ptr += sprintf(ptr, "%s\n", _(f->phrase));
|
||||||
|
|
||||||
if (f->blank_after)
|
if (f->blank_after)
|
||||||
ptr += sprintf(ptr, "\n");
|
ptr += sprintf(ptr, "\n");
|
||||||
|
|||||||
@ -480,7 +480,7 @@ void mouse_init(void)
|
|||||||
#endif /* ENABLE_MOUSE */
|
#endif /* ENABLE_MOUSE */
|
||||||
|
|
||||||
/* Print the usage line for the given option to the screen. */
|
/* 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 firstwidth = breadth(shortflag);
|
||||||
int secondwidth = breadth(longflag);
|
int secondwidth = breadth(longflag);
|
||||||
@ -493,7 +493,7 @@ void print_opt(const char *shortflag, const char *longflag, const char *desc)
|
|||||||
if (secondwidth < 24)
|
if (secondwidth < 24)
|
||||||
printf("%*s", 24 - secondwidth, " ");
|
printf("%*s", 24 - secondwidth, " ");
|
||||||
|
|
||||||
printf("%s\n", _(desc));
|
printf("%s\n", _(description));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Explain how to properly use nano and its command-line options. */
|
/* Explain how to properly use nano and its command-line options. */
|
||||||
|
|||||||
@ -1348,7 +1348,7 @@ static void check_vitals_mapped(void)
|
|||||||
if (f->func == vitals[v] && f->menus & inmenus[v]) {
|
if (f->func == vitals[v] && f->menus & inmenus[v]) {
|
||||||
if (first_sc_for(inmenus[v], f->func) == NULL) {
|
if (first_sc_for(inmenus[v], f->func) == NULL) {
|
||||||
jot_error(N_("No key is bound to function '%s' in menu '%s'. "
|
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 "
|
die(_("If needed, use nano with the -I option "
|
||||||
"to adjust your nanorc settings.\n"));
|
"to adjust your nanorc settings.\n"));
|
||||||
} else
|
} else
|
||||||
|
|||||||
@ -2484,7 +2484,7 @@ void bottombars(int menu)
|
|||||||
if (index + 2 >= number)
|
if (index + 2 >= number)
|
||||||
thiswidth += COLS % itemwidth;
|
thiswidth += COLS % itemwidth;
|
||||||
|
|
||||||
post_one_key(s->keystr, _(f->desc), thiswidth);
|
post_one_key(s->keystr, _(f->tag), thiswidth);
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user