diff --git a/format-draw.c b/format-draw.c index 3fb6a9ae3..14fdf5aaa 100644 --- a/format-draw.c +++ b/format-draw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format-draw.c,v 1.34 2026/07/21 07:20:18 nicm Exp $ */ +/* $OpenBSD: format-draw.c,v 1.36 2026/10/15 22:34:26 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott @@ -223,6 +223,31 @@ format_draw_none(struct screen_write_ctx *octx, u_int available, u_int ocx, width_abs_centre); } +/* Append the text after a list to its alignment screen. */ +static void +format_draw_merge(struct screen *s, u_int width, struct screen *after, + u_int width_after, struct format_ranges *frs) +{ + struct screen_write_ctx ctx; + struct format_range *fr; + + format_update_ranges(frs, s, 0, 0, width); + format_update_ranges(frs, after, width, 0, width_after); + + if (frs != NULL) { + TAILQ_FOREACH(fr, frs, entry) { + if (fr->s == after) + fr->s = s; + } + } + + screen_write_start(&ctx, s); + screen_write_cursormove(&ctx, width, 0, 0); + screen_write_fast_copy(&ctx, after, 0, 0, width_after, 1); + screen_write_cursormove(&ctx, width + width_after, 0, 0); + screen_write_stop(&ctx); +} + /* Draw format with list on the left. */ static void format_draw_left(struct screen_write_ctx *octx, u_int available, u_int ocx, @@ -231,9 +256,8 @@ format_draw_left(struct screen_write_ctx *octx, u_int available, u_int ocx, struct screen *list_right, struct screen *after, int focus_start, int focus_end, struct format_ranges *frs) { - u_int width_left, width_centre, width_right; - u_int width_list, width_after, width_abs_centre; - struct screen_write_ctx ctx; + u_int width_left, width_centre, width_right; + u_int width_list, width_after, width_abs_centre; width_left = left->cx; width_centre = centre->cx; @@ -265,9 +289,8 @@ format_draw_left(struct screen_write_ctx *octx, u_int available, u_int ocx, /* If there is no list left, pass off to the no list function. */ if (width_list == 0) { - screen_write_start(&ctx, left); - screen_write_fast_copy(&ctx, after, 0, 0, width_after, 1); - screen_write_stop(&ctx); + format_update_ranges(frs, list, 0, 0, 0); + format_draw_merge(left, width_left, after, width_after, frs); format_draw_none(octx, available, ocx, ocy, left, centre, right, abs_centre, frs); @@ -334,9 +357,8 @@ format_draw_centre(struct screen_write_ctx *octx, u_int available, u_int ocx, struct screen *list_right, struct screen *after, int focus_start, int focus_end, struct format_ranges *frs) { - u_int width_left, width_centre, width_right, middle; - u_int width_list, width_after, width_abs_centre; - struct screen_write_ctx ctx; + u_int width_left, width_centre, width_right, middle; + u_int width_list, width_after, width_abs_centre; width_left = left->cx; width_centre = centre->cx; @@ -368,9 +390,8 @@ format_draw_centre(struct screen_write_ctx *octx, u_int available, u_int ocx, /* If there is no list left, pass off to the no list function. */ if (width_list == 0) { - screen_write_start(&ctx, centre); - screen_write_fast_copy(&ctx, after, 0, 0, width_after, 1); - screen_write_stop(&ctx); + format_update_ranges(frs, list, 0, 0, 0); + format_draw_merge(centre, width_centre, after, width_after, frs); format_draw_none(octx, available, ocx, ocy, left, centre, right, abs_centre, frs); @@ -442,9 +463,8 @@ format_draw_right(struct screen_write_ctx *octx, u_int available, u_int ocx, struct screen *list_left, struct screen *list_right, struct screen *after, int focus_start, int focus_end, struct format_ranges *frs) { - u_int width_left, width_centre, width_right; - u_int width_list, width_after, width_abs_centre; - struct screen_write_ctx ctx; + u_int width_left, width_centre, width_right; + u_int width_list, width_after, width_abs_centre; width_left = left->cx; width_centre = centre->cx; @@ -476,9 +496,8 @@ format_draw_right(struct screen_write_ctx *octx, u_int available, u_int ocx, /* If there is no list left, pass off to the no list function. */ if (width_list == 0) { - screen_write_start(&ctx, right); - screen_write_fast_copy(&ctx, after, 0, 0, width_after, 1); - screen_write_stop(&ctx); + format_update_ranges(frs, list, 0, 0, 0); + format_draw_merge(right, width_right, after, width_after, frs); format_draw_none(octx, available, ocx, ocy, left, centre, right, abs_centre, frs); @@ -1007,6 +1026,14 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base, */ switch (list_align) { case STYLE_ALIGN_DEFAULT: + if (s[LIST].cx != 0 || s[AFTER].cx != 0) { + /* A list with default alignment is part of the left. */ + format_draw_left(octx, available, ocx, ocy, &s[LEFT], + &s[CENTRE], &s[RIGHT], &s[ABSOLUTE_CENTRE], + &s[LIST], &s[LIST_LEFT], &s[LIST_RIGHT], &s[AFTER], + focus_start, focus_end, &frs); + break; + } /* No list. */ format_draw_none(octx, available, ocx, ocy, &s[LEFT], &s[CENTRE], &s[RIGHT], &s[ABSOLUTE_CENTRE], &frs); diff --git a/resize.c b/resize.c index 108f7c318..386603dcf 100644 --- a/resize.c +++ b/resize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resize.c,v 1.60 2026/10/12 13:08:19 nicm Exp $ */ +/* $OpenBSD: resize.c,v 1.61 2026/10/15 22:28:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -472,7 +472,7 @@ recalculate_sizes_now(int now) s = c->session; if (s != NULL && !(c->flags & CLIENT_UNATTACHEDFLAGS)) s->attached++; - if (ignore_client_size(c)) + if (s == NULL) continue; if (c->tty.sy <= s->statuslines || (c->flags & CLIENT_CONTROL)) c->flags |= CLIENT_STATUSOFF; diff --git a/tty.c b/tty.c index 08013d942..33d694fd8 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.489 2026/10/14 12:48:50 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.490 2026/10/15 22:29:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1189,7 +1189,7 @@ tty_clamp_line(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py, *rx = nx; } else if (xoff < (int)ctx->wox && xoff + nx > ctx->wox + ctx->wsx) { /* Both left and right not visible. */ - *i = ctx->wox; + *i = ctx->wox - xoff; *x = 0; *rx = ctx->wsx; } else if (xoff < (int)ctx->wox) { @@ -1283,7 +1283,7 @@ tty_clamp_area(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py, *rx = nx; } else if (xoff < ctx->wox && xoff + nx > ctx->wox + ctx->wsx) { /* Both left and right not visible. */ - *i = ctx->wox; + *i = ctx->wox - xoff; *x = 0; *rx = ctx->wsx; } else if (xoff < ctx->wox) {