From ff8c869b5ec0cc1f9d1391217e1c82e75d0e9f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Wagner?= Date: Tue, 5 Jan 2021 17:24:55 +0100 Subject: [PATCH] preserve all bytes except spaces when wrapping When wrapping the new line should not start with a space. All other bytes must be preserved to avoid breaking unicode chars. fix for ~sircmpwn/gmni#21 --- src/gmnlm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gmnlm.c b/src/gmnlm.c index c0b2dd7..59755a4 100644 --- a/src/gmnlm.c +++ b/src/gmnlm.c @@ -739,7 +739,7 @@ wrap(FILE *f, char *s, struct winsize *ws, int *row, int *col) } char c = s[i]; s[i] = 0; - int n = fprintf(f, "%s\n", s); + int n = fprintf(f, "%s\n", s) - (isspace(c) ? 0 : 1); s[i] = c; *row += 1; *col = 0;