nano

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

commit d0dc270eec8ca8eeab9ea5314d340e96bbb67efa
parent cd9402075a2a8931b7c4e32817eee9187bfe239b
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 28 Aug 2022 08:57:03 +0200

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

Diffstat:
Msrc/definitions.h | 11+++++------
Msrc/files.c | 4++--
Msrc/global.c | 8++++----
Msrc/help.c | 4++--
Msrc/nano.c | 4++--
Msrc/rcfile.c | 2+-
Msrc/winio.c | 2+-
7 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/src/definitions.h b/src/definitions.h @@ -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. */ diff --git a/src/files.c b/src/files.c @@ -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 */ diff --git a/src/global.c b/src/global.c @@ -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 } diff --git a/src/help.c b/src/help.c @@ -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"); diff --git a/src/nano.c b/src/nano.c @@ -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. */ diff --git a/src/rcfile.c b/src/rcfile.c @@ -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 diff --git a/src/winio.c b/src/winio.c @@ -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++; }