Add unused "attr" argument to map_unicode

This commit is contained in:
Jeff Epler 2024-10-28 07:53:17 -05:00
parent 2f4551d975
commit 2298401af3
3 changed files with 14 additions and 5 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
};