summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-09-02 17:03:14 -0400
committerJune McEnroe <june@causal.agency>2020-09-02 17:08:21 -0400
commit16737d4edc73e3fdc9f6e8f3fc147a549cb5e563 (patch)
tree754eb545876383171b15fba9fa6c6522f248e0e4
parentStill add ignored lines to unreadHard (diff)
downloadcatgirl-16737d4edc73e3fdc9f6e8f3fc147a549cb5e563.tar.gz
catgirl-16737d4edc73e3fdc9f6e8f3fc147a549cb5e563.zip
Preserve style after alignment
This makes wrapping text with background colour look much better.
Diffstat (limited to '')
-rw-r--r--buffer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/buffer.c b/buffer.c
index fd69cd3..711d5fd 100644
--- a/buffer.c
+++ b/buffer.c
@@ -33,6 +33,7 @@
 #include <sysexits.h>
 #include <time.h>
 #include <wchar.h>
+#include <wctype.h>
 
 #include "chat.h"
 
@@ -160,10 +161,10 @@ static int flow(struct Lines *hard, int cols, const struct Line *soft) {
 		if (!line->str) err(EX_OSERR, "malloc");
 
 		struct Cat cat = { line->str, cap, 0 };
+		catf(&cat, "%*s%n", align, "", &width);
 		styleCat(&cat, style);
 		str = &line->str[cat.len];
-		catf(&cat, "%*s%n%s", align, "", &width, &wrap[n]);
-		str += width;
+		catf(&cat, "%s", &wrap[n]);
 
 		*wrap = '\0';
 		wrap = NULL;
td colspan='3' class='logmsg'> Simplifies ANSI and IRC output code, and prepares for line numbered output. 2019-02-15Color format specifiers light cyan in vimJune McEnroe 2019-02-15Highlight Interp as yellowJune McEnroe 2019-02-15Highlight strings in sh command substitutionsJune McEnroe 2019-02-15Add nmap gpJune McEnroe 2019-02-14Avoid newline when copying URL to pasteboardJune McEnroe 2019-02-13Add forgotten "sixth" book of H2G2June McEnroe