commit ff8c869b5ec0cc1f9d1391217e1c82e75d0e9f21
parent 00f62ff578f294413e4652fb4e9f2870da0cd60a
Author: René Wagner <rwagner@rw-net.de>
Date: Tue, 5 Jan 2021 17:24:55 +0100
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
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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;