about summary refs log tree commit diff
path: root/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--buffer.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/buffer.c b/buffer.c
index 740e598..15d89f8 100644
--- a/buffer.c
+++ b/buffer.c
@@ -160,11 +160,18 @@ static int flow(struct Lines *hard, int cols, const struct Line *soft) {
 			wrapStyle = style;
 		}
 
-		n = mbtowc(&wc, wrap, strlen(wrap));
-		if (n < 0) {
-			n = 1;
-		} else if (!iswspace(wc)) {
-			n = 0;
+		n = 0;
+		len = strlen(wrap);
+		for (int m; wrap[n] && (m = mbtowc(&wc, &wrap[n], len - n)); n += m) {
+			if (m < 0) {
+				m = 1;
+			} else if (!iswspace(wc)) {
+				break;
+			}
+		}
+		if (!wrap[n]) {
+			*wrap = '\0';
+			break;
 		}
 
 		flowed++;
:44 -0500'>2019-12-31Color both nicks in a changeJune McEnroe 2019-12-31Implement nick-colored outputJune McEnroe 2019-12-31Only enable highlighting on terminal outputJune McEnroe 2019-12-31Set up pager pipeJune McEnroe 2019-12-30Normalize date inputJune McEnroe 2019-12-30Add initial rough version of scoopJune McEnroe 2019-12-30Join with USING wherever possibleJune McEnroe 2019-12-30Add -D flag to prospective scoop manualJune McEnroe 2019-12-30Order results by ID in outer query in litterboxJune McEnroe 2019-12-30Use X macro for Type enumJune McEnroe 2019-12-30Remove scoop -ABCJune McEnroe 2019-12-30Add limit option for litterbox's search query interfaceJune McEnroe