Collapse whitespace while wrapping and discard trailing space
The latter avoids an extra blank line when a message ends with whitespace that hits the edge of the window.weechat-hashes
parent
4b883177dc
commit
3b54425ec1
17
buffer.c
17
buffer.c
|
@ -160,11 +160,18 @@ static int flow(struct Lines *hard, int cols, const struct Line *soft) {
|
||||||
wrapStyle = style;
|
wrapStyle = style;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = mbtowc(&wc, wrap, strlen(wrap));
|
n = 0;
|
||||||
if (n < 0) {
|
len = strlen(wrap);
|
||||||
n = 1;
|
for (int m; wrap[n] && (m = mbtowc(&wc, &wrap[n], len - n)); n += m) {
|
||||||
} else if (!iswspace(wc)) {
|
if (m < 0) {
|
||||||
n = 0;
|
m = 1;
|
||||||
|
} else if (!iswspace(wc)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!wrap[n]) {
|
||||||
|
*wrap = '\0';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
flowed++;
|
flowed++;
|
||||||
|
|
Loading…
Reference in New Issue