help: set tabsize to the default width while showing a help text

So that the shortcut explanations get properly aligned.
master
Benno Schulenberg 2017-04-18 14:54:11 +02:00
parent e05dfda2be
commit 7e1648fdb0
1 changed files with 4 additions and 1 deletions

View File

@ -106,6 +106,7 @@ void do_help(void)
int line_size; int line_size;
int saved_margin = margin; int saved_margin = margin;
/* For avoiding the line numbers on the help screen. */ /* For avoiding the line numbers on the help screen. */
ssize_t was_tabsize = tabsize;
char *saved_answer = (answer != NULL) ? strdup(answer) : NULL; char *saved_answer = (answer != NULL) ? strdup(answer) : NULL;
/* Store current answer when user invokes help at the prompt. */ /* Store current answer when user invokes help at the prompt. */
unsigned stash[sizeof(flags) / sizeof(flags[0])]; unsigned stash[sizeof(flags) / sizeof(flags[0])];
@ -124,7 +125,8 @@ void do_help(void)
fclose(fp); fclose(fp);
/* Set help_text as the string to display. */ /* Compose the help text from all the pieces. */
tabsize = 8;
help_init(); help_init();
inhelp = TRUE; inhelp = TRUE;
location = 0; location = 0;
@ -266,6 +268,7 @@ void do_help(void)
free(answer); free(answer);
answer = saved_answer; answer = saved_answer;
tabsize = was_tabsize;
remove(tempfilename); remove(tempfilename);
free(tempfilename); free(tempfilename);