commit 3f57200e10b2b3cc8ef8164ed11d52c7a65dda79
parent 1486f32d42cfe5bf4563073788f6a0660401aafb
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 9 Jan 2020 12:02:49 +0100
help: prevent double spaces from protruding across the right edge
This fixes https://savannah.gnu.org/bugs/?57563.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/help.c b/src/help.c
@@ -51,7 +51,7 @@ void wrap_help_text_into_buffer(void)
/* Copy the help text into the just-created new buffer. */
while (*ptr != '\0') {
- int length;
+ int length, shim;
char *oneline;
if (ptr >= end_of_intro)
@@ -64,7 +64,8 @@ void wrap_help_text_into_buffer(void)
} else {
length = break_line(ptr, wrapping_point, TRUE);
oneline = nmalloc(length + 1);
- snprintf(oneline, length + 1, "%s", ptr);
+ shim = (*(ptr + length - 1) == ' ') ? 0 : 1;
+ snprintf(oneline, length + shim, "%s", ptr);
}
free(openfile->current->data);