1
0
mirror of https://git.sr.ht/~sircmpwn/gmni synced 2024-11-22 20:32:03 +01:00

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
This commit is contained in:
René Wagner 2021-01-05 17:24:55 +01:00 committed by Drew DeVault
parent 00f62ff578
commit ff8c869b5e

@ -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;