diff --git a/screen-write.c b/screen-write.c index c23f2d508..9fd14af52 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.302 2026/10/16 07:59:06 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.303 2026/10/16 11:33:44 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1613,35 +1613,12 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg) struct screen *s = ctx->s; struct grid *gd = s->grid; struct tty_ctx ttyctx; - u_int sy = screen_size_y(s); if (ny == 0) ny = 1; - if (s->cy < s->rupper || s->cy > s->rlower) { - if (ny > sy - s->cy) - ny = sy - s->cy; - if (ny == 0) - return; - - screen_write_initctx(ctx, &ttyctx, 1, 1); - ttyctx.bg = bg; - - grid_view_insert_lines(gd, s->cy, ny, bg); - - screen_write_collect_flush(ctx, 0, __func__); - ttyctx.n = ny; - - if (!screen_write_should_draw_lines(ctx, s->cy, sy - s->cy)) - return; - if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { - tty_write(tty_cmd_insertline, &ttyctx); - return; - } - - screen_write_redraw_pane(ctx, &ttyctx); + if (s->cy < s->rupper || s->cy > s->rlower) return; - } if (ny > s->rlower + 1 - s->cy) ny = s->rlower + 1 - s->cy; @@ -1651,10 +1628,7 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg) screen_write_initctx(ctx, &ttyctx, 1, 1); ttyctx.bg = bg; - if (s->cy < s->rupper || s->cy > s->rlower) - grid_view_insert_lines(gd, s->cy, ny, bg); - else - grid_view_insert_lines_region(gd, s->rlower, s->cy, ny, bg); + grid_view_insert_lines_region(gd, s->rlower, s->cy, ny, bg); screen_write_collect_flush(ctx, 0, __func__); ttyctx.n = ny; @@ -1676,36 +1650,13 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg) struct screen *s = ctx->s; struct grid *gd = s->grid; struct tty_ctx ttyctx; - u_int sy = screen_size_y(s), ry; + u_int ry; if (ny == 0) ny = 1; - if (s->cy < s->rupper || s->cy > s->rlower) { - if (ny > sy - s->cy) - ny = sy - s->cy; - if (ny == 0) - return; - - screen_write_initctx(ctx, &ttyctx, 1, 1); - ttyctx.bg = bg; - - grid_view_delete_lines(gd, s->cy, ny, bg); - - screen_write_collect_flush(ctx, 0, __func__); - ttyctx.n = ny; - - ry = s->rlower + 1 - s->rupper; - if (!screen_write_should_draw_lines(ctx, s->rupper, ry)) - return; - if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { - tty_write(tty_cmd_deleteline, &ttyctx); - return; - } - - screen_write_redraw_pane(ctx, &ttyctx); + if (s->cy < s->rupper || s->cy > s->rlower) return; - } ry = s->rlower + 1 - s->cy; if (ny > ry) @@ -1716,10 +1667,7 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg) screen_write_initctx(ctx, &ttyctx, 1, 1); ttyctx.bg = bg; - if (s->cy < s->rupper || s->cy > s->rlower) - grid_view_delete_lines(gd, s->cy, ny, bg); - else - grid_view_delete_lines_region(gd, s->rlower, s->cy, ny, bg); + grid_view_delete_lines_region(gd, s->rlower, s->cy, ny, bg); screen_write_collect_flush(ctx, 0, __func__); ttyctx.n = ny;