From 2298401af3460898705ee94e4ea3333bea5f381c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 28 Oct 2024 07:53:17 -0500 Subject: [PATCH] Add unused "attr" argument to map_unicode --- chargen.c | 3 ++- hl-vt100/src/lw_terminal_vt100.c | 14 +++++++++++--- hl-vt100/src/lw_terminal_vt100.h | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/chargen.c b/chargen.c index 6d0cb62..d1d0e55 100644 --- a/chargen.c +++ b/chargen.c @@ -496,7 +496,8 @@ static void master_write(void *user_data, void *buffer_in, size_t len) { } } -static int map_unicode(void *unused, int n) { +static int map_unicode(void *unused, int n, lw_cell_t *attr) { + (void)attr; // future for sixel inversion switch (n) { case 9670: return 1; diff --git a/hl-vt100/src/lw_terminal_vt100.c b/hl-vt100/src/lw_terminal_vt100.c index d8e084f..9dccef8 100644 --- a/hl-vt100/src/lw_terminal_vt100.c +++ b/hl-vt100/src/lw_terminal_vt100.c @@ -334,7 +334,12 @@ x Pm = 97 / 107 fg/bg Bright White x Pm = 99 / 109 fg/bg Bright Default */ -static int default_map_unicode(void *user_data, int c) { return '?'; } +static int default_map_unicode(void *user_data, int c, lw_cell_t *attr) { + (void)user_data; + (void)c; + (void)attr; + return '?'; +} static lw_cell_t default_encode_attr(void *user_data, const struct lw_parsed_attr *attr) { @@ -1028,6 +1033,9 @@ static void vt100_write_unicode(struct lw_terminal *term_emul, int c) { if (c < ' ') { return; } + + lw_cell_t attr = vt100->attr; + if (vt100->x == vt100->width) { if (MODE_IS_SET(vt100, DECAWM)) NEL(term_emul); @@ -1038,9 +1046,9 @@ static void vt100_write_unicode(struct lw_terminal *term_emul, int c) { c = c - 95; } if (c >= 0x100) { - c = vt100->map_unicode(vt100, c); + c = vt100->map_unicode(vt100, c, &attr); } - set(vt100, vt100->x, vt100->y, c); + aset(vt100, vt100->x, vt100->y, c | attr); vt100->x += 1; } diff --git a/hl-vt100/src/lw_terminal_vt100.h b/hl-vt100/src/lw_terminal_vt100.h index d109b58..b51a1ca 100644 --- a/hl-vt100/src/lw_terminal_vt100.h +++ b/hl-vt100/src/lw_terminal_vt100.h @@ -106,7 +106,7 @@ struct lw_terminal_vt100 { void (*master_write)(void *user_data, void *buffer, size_t len); lw_cell_t (*encode_attr)(void *user_data, const struct lw_parsed_attr *attr); - int (*map_unicode)(void *user_data, int c); + int (*map_unicode)(void *user_data, int c, lw_cell_t *attr); void *user_data; };