diff options
author | nicm <nicm> | 2019-03-14 09:53:52 +0000 |
---|---|---|
committer | nicm <nicm> | 2019-03-14 09:53:52 +0000 |
commit | 13f9a061acd966757ae2f42c3a8ac24765ac65bd (patch) | |
tree | aaf112dfe439c6317ed449651db77285ac601566 /screen-write.c | |
parent | 1e9f8a3523ac93203036bd4a3740674a91fc4f1c (diff) | |
download | rtmux-13f9a061acd966757ae2f42c3a8ac24765ac65bd.tar.gz rtmux-13f9a061acd966757ae2f42c3a8ac24765ac65bd.tar.bz2 rtmux-13f9a061acd966757ae2f42c3a8ac24765ac65bd.zip |
Add a wrapper (struct style) around styles rather than using the
grid_cell directly. There will be some non-cell members soon.
Diffstat (limited to 'screen-write.c')
-rw-r--r-- | screen-write.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/screen-write.c b/screen-write.c index 9153ad27..eb12474d 100644 --- a/screen-write.c +++ b/screen-write.c @@ -327,15 +327,15 @@ void screen_write_cnputs(struct screen_write_ctx *ctx, ssize_t maxlen, const struct grid_cell *gcp, const char *fmt, ...) { - struct grid_cell gc; - struct utf8_data *ud = &gc.data; + struct style sy; + struct utf8_data *ud = &sy.gc.data; va_list ap; char *msg; u_char *ptr, *last; size_t left, size = 0; enum utf8_state more; - memcpy(&gc, gcp, sizeof gc); + style_set(&sy, gcp); va_start(ap, fmt); xvasprintf(&msg, fmt, ap); @@ -352,7 +352,7 @@ screen_write_cnputs(struct screen_write_ctx *ctx, ssize_t maxlen, } *last = '\0'; - style_parse(gcp, &gc, ptr); + style_parse(&sy, gcp, ptr); ptr = last + 1; continue; } @@ -370,22 +370,22 @@ screen_write_cnputs(struct screen_write_ctx *ctx, ssize_t maxlen, continue; if (maxlen > 0 && size + ud->width > (size_t)maxlen) { while (size < (size_t)maxlen) { - screen_write_putc(ctx, &gc, ' '); + screen_write_putc(ctx, &sy.gc, ' '); size++; } break; } size += ud->width; - screen_write_cell(ctx, &gc); + screen_write_cell(ctx, &sy.gc); } else { if (maxlen > 0 && size + 1 > (size_t)maxlen) break; if (*ptr == '\001') - gc.attr ^= GRID_ATTR_CHARSET; + sy.gc.attr ^= GRID_ATTR_CHARSET; else if (*ptr > 0x1f && *ptr < 0x7f) { size++; - screen_write_putc(ctx, &gc, *ptr); + screen_write_putc(ctx, &sy.gc, *ptr); } ptr++; } |