Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-06-19 11:15:06 +01:00

View File

@@ -78,7 +78,7 @@ tty_draw_line_clear(struct tty *tty, u_int px, u_int py, u_int nx,
} }
} }
/* Couldn't use an escape sequence, use spaces. */ /* Couldn't use an escape sequence, use spaces. */
if (px != 0 || !wrapped) if (px != 0 || !wrapped)
tty_cursor(tty, px, py); tty_cursor(tty, px, py);
if (nx == 1) if (nx == 1)
@@ -105,13 +105,14 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
size_t len; size_t len;
enum tty_draw_line_state current_state, next_state; enum tty_draw_line_state current_state, next_state;
struct tty_style_ctx default_style_ctx = { 0 }; struct tty_style_ctx default_style_ctx = { 0 };
const struct grid_cell *defaults;
if (style_ctx == NULL) { if (style_ctx == NULL) {
default_style_ctx.defaults = &grid_default_cell; default_style_ctx.defaults = &grid_default_cell;
default_style_ctx.hyperlinks = s->hyperlinks; default_style_ctx.hyperlinks = s->hyperlinks;
style_ctx = &default_style_ctx; style_ctx = &default_style_ctx;
} }
defaults = style_ctx->defaults;
/* /*
* py is the line in the screen to draw. px is the start x and nx is * py is the line in the screen to draw. px is the start x and nx is
@@ -138,8 +139,8 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
else else
ex = screen_size_x(s); ex = screen_size_x(s);
log_debug("%s: drawing %u-%u,%u (end %u) at %u,%u; defaults: fg=%d, " log_debug("%s: drawing %u-%u,%u (end %u) at %u,%u; defaults: fg=%d, "
"bg=%d", __func__, px, px + nx, py, ex, atx, aty, "bg=%d", __func__, px, px + nx, py, ex, atx, aty, defaults->fg,
style_ctx->defaults->fg, style_ctx->defaults->bg); defaults->bg);
/* Turn off cursor while redrawing and reset region and margins. */ /* Turn off cursor while redrawing and reset region and margins. */
flags = (tty->flags & TTY_NOCURSOR); flags = (tty->flags & TTY_NOCURSOR);
@@ -150,7 +151,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
/* Start with the default cell as the last cell. */ /* Start with the default cell as the last cell. */
memcpy(&last, &grid_default_cell, sizeof last); memcpy(&last, &grid_default_cell, sizeof last);
last.bg = style_ctx->defaults->bg; last.bg = defaults->bg;
tty_default_attributes(tty, 8, style_ctx); tty_default_attributes(tty, 8, style_ctx);
/* /*
@@ -172,7 +173,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
break; break;
} }
if (i == 0) if (i == 0)
bg = style_ctx->defaults->bg; bg = defaults->bg;
else { else {
bg = gc.bg; bg = gc.bg;
if (gc.flags & GRID_FLAG_SELECTED) { if (gc.flags & GRID_FLAG_SELECTED) {
@@ -183,7 +184,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
} }
tty_attributes(tty, &last, style_ctx); tty_attributes(tty, &last, style_ctx);
log_debug("%s: clearing %u padding cells", __func__, cx); log_debug("%s: clearing %u padding cells", __func__, cx);
tty_draw_line_clear(tty, atx, aty, cx, style_ctx->defaults, bg, 0); tty_draw_line_clear(tty, atx, aty, cx, defaults, bg, 0);
if (cx == ex) if (cx == ex)
goto out; goto out;
atx += cx; atx += cx;
@@ -284,8 +285,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
if (current_state == TTY_DRAW_LINE_EMPTY) { if (current_state == TTY_DRAW_LINE_EMPTY) {
tty_attributes(tty, &last, style_ctx); tty_attributes(tty, &last, style_ctx);
tty_draw_line_clear(tty, atx + last_i, aty, tty_draw_line_clear(tty, atx + last_i, aty,
i - last_i, style_ctx->defaults, last.bg, i - last_i, defaults, last.bg, wrapped);
wrapped);
wrapped = 0; wrapped = 0;
} else if (next_state != TTY_DRAW_LINE_SAME && } else if (next_state != TTY_DRAW_LINE_SAME &&
len != 0) { len != 0) {