diff --git a/src/cgmnlm.c b/src/cgmnlm.c
index 60b275d1f8b8425206dd7000a221d60c7473ddff..38ac821cff06602aba88c5e1c414aeccf3eb1e1f 100644
--- a/src/cgmnlm.c
+++ b/src/cgmnlm.c
@@ -733,9 +733,7 @@ default:
// skip unicode continuation bytes
if ((s[i] & 0xc0) == 0x80) break;
- if (iscntrl(s[i])) {
- s[i] = '.';
- }
+ if (iscntrl(s[i])) s[i] = '.';
*col += 1;
break;
}
@@ -743,12 +741,10 @@
if (*col >= ws->ws_col) {
int j = i--;
while (&s[i] != s && !isspace(s[i])) --i;
- if (&s[i] == s) {
- i = j;
- }
+ if (&s[i] == s) i = j;
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;