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>
master
Benno Schulenberg 2019-05-22 19:55:25 +02:00
parent 12bf3bfce4
commit 2f1691079e
1 changed files with 3 additions and 12 deletions

View File

@ -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. */