From 6e5195f650fb7bcaaf596119105662ba4b2df449 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 3 Apr 2020 17:19:15 +0200 Subject: [PATCH] tweaks: invert a condition, to have two clauses in a more logical order First the clause for the intro text and the normal lines, and then the clause for the continuation lines (that are narrower and indented). Also, avoid blanking the status bar when initializing the subwindows anyway, and avoid an unneeded resfreshing call -- the bottombars() function will take care of that. --- src/help.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/help.c b/src/help.c index 23fbd201..59a45a4d 100644 --- a/src/help.c +++ b/src/help.c @@ -57,15 +57,15 @@ void wrap_help_text_into_buffer(void) if (ptr == end_of_intro) wrapping_point = (COLS < 40) ? 40 : COLS; - if (ptr > end_of_intro && *(ptr - 1) != '\n') { - length = break_line(ptr, (COLS < 40) ? 22 : COLS - 18, TRUE); - oneline = nmalloc(length + 5); - snprintf(oneline, length + 5, "\t\t %s", ptr); - } else { + if (ptr < end_of_intro || *(ptr - 1) == '\n') { length = break_line(ptr, wrapping_point, TRUE); oneline = nmalloc(length + 1); shim = (*(ptr + length - 1) == ' ') ? 0 : 1; snprintf(oneline, length + shim, "%s", ptr); + } else { + length = break_line(ptr, (COLS < 40) ? 22 : COLS - 18, TRUE); + oneline = nmalloc(length + 5); + snprintf(oneline, length + 5, "\t\t %s", ptr); } free(openfile->current->data); @@ -125,8 +125,6 @@ void show_help(void) linestruct *line; int length; - blank_statusbar(); - /* Save the settings of all flags. */ memcpy(stash, flags, sizeof(flags)); @@ -134,7 +132,8 @@ void show_help(void) if (ISSET(NO_HELP) && LINES > 4) { UNSET(NO_HELP); window_init(); - } + } else + blank_statusbar(); /* When searching, do it forward, case insensitive, and without regexes. */ UNSET(BACKWARDS_SEARCH); @@ -272,7 +271,7 @@ void show_help(void) currmenu = oldmenu; window_init(); } else { - wipe_statusbar(); + blank_statusbar(); bottombars(oldmenu); }