commit 2f1691079e7c81ad29f1927911dadeef668670a4
parent 12bf3bfce479e94af1860b298bdb79d0d7cf2c87
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 22 May 2019 19:55:25 +0200
usage: make the --help output independent from the terminal's tab size
Use printf's ability to align things (instead of trying to do it
ourselves and failing when the tab size of the terminal is not 8.)
Suggested-by: Vincent Huisman <site.gentoobugzilla@dataghost.com>
This fixes https://savannah.gnu.org/bugs/?56372.
Reported-by: Vincent Huisman <site.gentoobugzilla@dataghost.com>
Diffstat:
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -709,17 +709,7 @@ void mouse_init(void)
/* Print the usage line for the given option to the screen. */
void print_opt(const char *shortflag, const char *longflag, const char *desc)
{
- printf(" %s\t", shortflag);
- if (breadth(shortflag) < 8)
- printf("\t");
-
- printf("%s\t", longflag);
- if (breadth(longflag) < 8)
- printf("\t\t");
- else if (breadth(longflag) < 16)
- printf("\t");
-
- printf("%s\n", _(desc));
+ printf(" %-14s %-23s %s\n", shortflag, longflag, _(desc));
}
/* Explain how to properly use nano and its command-line options. */
@@ -731,7 +721,8 @@ void usage(void)
printf(_("To place the cursor on a specific line of a file, put the line number with\n"
"a '+' before the filename. The column number can be added after a comma.\n"));
printf(_("When a filename is '-', nano reads data from standard input.\n\n"));
- printf(_("Option\t\tGNU long option\t\tMeaning\n"));
+ /* TRANSLATORS: The next three are column headers of the --help output. */
+ printf("%-16s%-26s%s\n", _("Option"), _("Long option"), _("Meaning"));
#ifndef NANO_TINY
/* TRANSLATORS: The next forty or so strings are option descriptions
* for the --help output. Try to keep them at most 40 characters. */