commit 1486f32d42cfe5bf4563073788f6a0660401aafb
parent e3edce4e7b272c5538b2260d9336f7d615cb420a
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 9 Jan 2020 11:37:49 +0100
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.
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git 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;