Fix issue where popup window gets overwritten by background updates,

from Conor Taylor in GitHub issue 4920.
This commit is contained in:
nicm
2026-03-23 08:48:32 +00:00
parent d22ab85b84
commit d70edfa0a0
2 changed files with 54 additions and 16 deletions

View File

@@ -48,12 +48,19 @@ static void
tty_draw_line_clear(struct tty *tty, u_int px, u_int py, u_int nx,
const struct grid_cell *defaults, u_int bg, int wrapped)
{
struct visible_ranges *r;
struct visible_range *rr;
u_int i;
/* Nothing to clear. */
if (nx == 0)
return;
/* If genuine BCE is available, can try escape sequences. */
if (!wrapped && nx >= 10 && !tty_fake_bce(tty, defaults, bg)) {
if (tty->client->overlay_check == NULL &&
!wrapped &&
nx >= 10 &&
!tty_fake_bce(tty, defaults, bg)) {
/* Off the end of the line, use EL if available. */
if (px + nx >= tty->sx && tty_term_has(tty->term, TTYC_EL)) {
tty_cursor(tty, px, py);
@@ -77,14 +84,20 @@ tty_draw_line_clear(struct tty *tty, u_int px, u_int py, u_int nx,
}
/* Couldn't use an escape sequence, use spaces. */
if (px != 0 || !wrapped)
tty_cursor(tty, px, py);
if (nx == 1)
tty_putc(tty, ' ');
else if (nx == 2)
tty_putn(tty, " ", 2, 2);
else
tty_repeat_space(tty, nx);
r = tty_check_overlay_range(tty, px, py, nx);
for (i = 0; i < r->used; i++) {
rr = &r->ranges[i];
if (rr->nx != 0) {
if (rr->px != 0 || !wrapped)
tty_cursor(tty, rr->px, py);
if (rr->nx == 1)
tty_putc(tty, ' ');
else if (rr->nx == 2)
tty_putn(tty, " ", 2, 2);
else
tty_repeat_space(tty, rr->nx);
}
}
}
/* Is this cell empty? */