From 1486f32d42cfe5bf4563073788f6a0660401aafb Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 9 Jan 2020 11:37:49 +0100 Subject: [PATCH] help: when a key description wraps, indent its wrapped part This prevents the wrapped text from cluttering up the two key columns. This addresses https://savannah.gnu.org/bugs/?57451. --- src/help.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/help.c b/src/help.c index 1ae9095d..04845d26 100644 --- a/src/help.c +++ b/src/help.c @@ -57,10 +57,16 @@ void wrap_help_text_into_buffer(void) if (ptr >= end_of_intro) wrapping_point = (COLS < 24) ? 24 : COLS; - length = break_line(ptr, wrapping_point, TRUE); - oneline = nmalloc(length + 1); + if (ptr > end_of_intro && *(ptr - 1) != '\n') { + length = break_line(ptr, (COLS < 24) ? 6 : COLS - 18, TRUE); + oneline = nmalloc(length + 5); + snprintf(oneline, length + 5, "\t\t %s", ptr); + } else { + length = break_line(ptr, wrapping_point, TRUE); + oneline = nmalloc(length + 1); + snprintf(oneline, length + 1, "%s", ptr); + } - snprintf(oneline, length + 1, "%s", ptr); free(openfile->current->data); openfile->current->data = oneline;