Correctly draw wide characters that are partially obscured.

This commit is contained in:
nicm 2021-08-06 03:13:05 +00:00
parent 93cc8df692
commit 97b5962ab1

17
tty.c
View File

@ -1349,7 +1349,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
struct grid_line *gl; struct grid_line *gl;
struct client *c = tty->client; struct client *c = tty->client;
u_int i, j, ux, sx, width; u_int i, j, ux, sx, width;
int flags, cleared = 0, wrapped = 0; int flags, cleared = 0, wrapped = 0, hidden;
char buf[512]; char buf[512];
size_t len; size_t len;
u_int cellsize; u_int cellsize;
@ -1449,10 +1449,16 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
screen_select_cell(s, &last, gcp); screen_select_cell(s, &last, gcp);
else else
memcpy(&last, gcp, sizeof last); memcpy(&last, gcp, sizeof last);
if (!tty_check_overlay(tty, atx + ux, aty)) {
if (~gcp->flags & GRID_FLAG_PADDING) hidden = 0;
ux += gcp->data.width; for (j = 0; j < gcp->data.width; j++) {
} else if (ux + gcp->data.width > nx) { if (!tty_check_overlay(tty, atx + ux + j, aty)) {
hidden = 1;
break;
}
}
if (hidden || ux + gcp->data.width > nx) {
if (~gcp->flags & GRID_FLAG_PADDING) {
tty_attributes(tty, &last, defaults, palette); tty_attributes(tty, &last, defaults, palette);
tty_cursor(tty, atx + ux, aty); tty_cursor(tty, atx + ux, aty);
for (j = 0; j < gcp->data.width; j++) { for (j = 0; j < gcp->data.width; j++) {
@ -1461,6 +1467,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
tty_putc(tty, ' '); tty_putc(tty, ' ');
ux++; ux++;
} }
}
} else if (gcp->attr & GRID_ATTR_CHARSET) { } else if (gcp->attr & GRID_ATTR_CHARSET) {
tty_attributes(tty, &last, defaults, palette); tty_attributes(tty, &last, defaults, palette);
tty_cursor(tty, atx + ux, aty); tty_cursor(tty, atx + ux, aty);