Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-05-25 09:15:07 +01:00
4 changed files with 125 additions and 70 deletions

View File

@@ -335,7 +335,7 @@ layout_assign(struct window_pane **wp, struct layout_cell *lc, int flags)
case LAYOUT_TOPBOTTOM: case LAYOUT_TOPBOTTOM:
case LAYOUT_FLOATING: case LAYOUT_FLOATING:
TAILQ_FOREACH(lcchild, &lc->cells, entry) TAILQ_FOREACH(lcchild, &lc->cells, entry)
layout_assign(wp, lcchild, PANE_FLOATING); layout_assign(wp, lcchild, flags);
return; return;
} }
} }

View File

@@ -702,7 +702,7 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
/* Left not visible. */ /* Left not visible. */
l = ctx->ox - xoff; l = ctx->ox - xoff;
x = 0; x = 0;
width = size - i; width = size - l;
} else { } else {
/* Right not visible. */ /* Right not visible. */
l = 0; l = 0;
@@ -710,7 +710,8 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
width = size - x; width = size - x;
} }
r = screen_redraw_get_visible_ranges(wp, x, yoff, width, NULL); r = tty_check_overlay_range(tty, x, yoff, width);
r = screen_redraw_get_visible_ranges(wp, x, yoff, width, r);
if (ctx->statustop) if (ctx->statustop)
yoff += ctx->statuslines; yoff += ctx->statuslines;
for (i = 0; i < r->used; i++) { for (i = 0; i < r->used; i++) {
@@ -1273,15 +1274,42 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
struct screen *s = wp->screen; struct screen *s = wp->screen;
struct colour_palette *palette = &wp->palette; struct colour_palette *palette = &wp->palette;
struct grid_cell defaults; struct grid_cell defaults;
u_int i, j, woy, wx, wy, py, width; u_int j, k, woy, wx, wy, py, width;
struct visible_ranges *r; struct visible_ranges *r;
struct visible_range *ri; struct visible_range *ri;
/*
* There are 3 coordinate spaces:
*
* window: (0 to w->sx-1, 0 to w->sy-1)
* tty: (0 to tty->sx-1, 0 to tty->sy-1)
* pane: (0 to wp->sx-1, 0 to wp->sy-1)
*
* Transformations:
* window <-> tty (x-axis):
* window_x = tty_x + ctx->ox
* tty_x = window_x - ctx->ox
*
* window <-> tty (y-axis):
* woy = (ctx->statustop) ? ctx->statuslines : 0
* window_y = tty_y + ctx->oy - woy
* tty_y = woy + window_y - ctx->oy
*
* window <-> pane (x-axis):
* window_x = pane_x + wp->xoff
* pane_x = window_x - wp->xoff
*
* window <-> pane (y-axis):
* window_y = pane_y + wp->yoff
* pane_y = window_y - wp->yoff
*/
if (wp->base.mode & MODE_SYNC) if (wp->base.mode & MODE_SYNC)
screen_write_stop_sync(wp); screen_write_stop_sync(wp);
log_debug("%s: %s @%u %%%u", __func__, c->name, w->id, wp->id); log_debug("%s: %s @%u %%%u", __func__, c->name, w->id, wp->id);
/* Check if pane completely not visible. */
if (wp->xoff + (int)wp->sx <= ctx->ox || if (wp->xoff + (int)wp->sx <= ctx->ox ||
wp->xoff >= (int)ctx->ox + (int)ctx->sx) wp->xoff >= (int)ctx->ox + (int)ctx->sx)
return; return;
@@ -1303,37 +1331,36 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
if (wp->xoff >= (int)ctx->ox && if (wp->xoff >= (int)ctx->ox &&
wp->xoff + (int)wp->sx <= (int)ctx->ox + (int)ctx->sx) { wp->xoff + (int)wp->sx <= (int)ctx->ox + (int)ctx->sx) {
/* All visible. */ /* All visible. */
i = 0;
wx = (u_int)(wp->xoff - (int)ctx->ox); wx = (u_int)(wp->xoff - (int)ctx->ox);
width = wp->sx; width = wp->sx;
} else if (wp->xoff < (int)ctx->ox && } else if (wp->xoff < (int)ctx->ox &&
wp->xoff + (int)wp->sx > (int)ctx->ox + (int)ctx->sx) { wp->xoff + (int)wp->sx > (int)ctx->ox + (int)ctx->sx) {
/* Both left and right not visible. */ /* Both left and right not visible. */
i = ctx->ox;
wx = 0; wx = 0;
width = ctx->sx; width = ctx->sx;
} else if (wp->xoff < (int)ctx->ox) { } else if (wp->xoff < (int)ctx->ox) {
/* Left not visible. */ /* Left not visible. */
i = (u_int)((int)ctx->ox - wp->xoff);
wx = 0; wx = 0;
width = wp->sx - i; width = wp->sx - ((u_int)((int)ctx->ox - wp->xoff));
} else { } else {
/* Right not visible. */ /* Right not visible. */
i = 0;
wx = (u_int)(wp->xoff - (int)ctx->ox); wx = (u_int)(wp->xoff - (int)ctx->ox);
width = ctx->sx - wx; width = ctx->sx - wx;
} }
log_debug("%s: %s %%%u line %u,%u at %u,%u, width %u",
__func__, c->name, wp->id, i, j, wx, wy, width);
/* Get visible ranges of line before we draw it. */ /* Get visible ranges of line before we draw it. */
r = screen_redraw_get_visible_ranges(wp, wx, wy, width, NULL); r = tty_check_overlay_range(tty, wx, wy, width);
r = screen_redraw_get_visible_ranges(wp, wx, wy, width, r);
tty_default_colours(&defaults, wp); tty_default_colours(&defaults, wp);
for (i = 0; i < r->used; i++) { for (k = 0; k < r->used; k++) {
ri = &r->ranges[i]; ri = &r->ranges[k];
if (ri->nx == 0) if (ri->nx == 0)
continue; continue;
tty_draw_line(tty, s, ri->px - wp->xoff, j, ri->nx, log_debug("%s: %s %%%u range pane (%u,%u) width %u, tty (%u,%u) width %u",
__func__, c->name, wp->id,
ri->px + (int)ctx->ox - wp->xoff, j, ri->nx,
ri->px, py, ri->nx);
tty_draw_line(tty, s, ri->px + (int)ctx->ox - wp->xoff, j, ri->nx,
ri->px, py, &defaults, palette); ri->px, py, &defaults, palette);
} }
} }
@@ -1495,7 +1522,7 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
for (j = jmin; j < jmax; j++) { for (j = jmin; j < jmax; j++) {
wy = sb_y + j; /* window y coordinate */ wy = sb_y + j; /* window y coordinate */
py = sb_tty_y + j;/* tty y coordinate */ py = sb_tty_y + j; /* tty y coordinate */
r = tty_check_overlay_range(tty, sb_x, wy, imax); r = tty_check_overlay_range(tty, sb_x, wy, imax);
r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r); r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r);
for (i = imin; i < imax; i++) { for (i = imin; i < imax; i++) {

View File

@@ -46,10 +46,6 @@ static void
tty_draw_line_clear(struct tty *tty, u_int px, u_int py, u_int nx, 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) const struct grid_cell *defaults, u_int bg, int wrapped)
{ {
struct visible_ranges *r;
struct visible_range *rr;
u_int i;
/* Nothing to clear. */ /* Nothing to clear. */
if (nx == 0) if (nx == 0)
return; return;
@@ -82,20 +78,14 @@ 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. */
r = tty_check_overlay_range(tty, px, py, nx); if (px != 0 || !wrapped)
for (i = 0; i < r->used; i++) { tty_cursor(tty, px, py);
rr = &r->ranges[i]; if (nx == 1)
if (rr->nx != 0) {
if (rr->px != 0 || !wrapped)
tty_cursor(tty, rr->px, py);
if (rr->nx == 1)
tty_putc(tty, ' '); tty_putc(tty, ' ');
else if (rr->nx == 2) else if (nx == 2)
tty_putn(tty, " ", 2, 2); tty_putn(tty, " ", 2, 2);
else else
tty_repeat_space(tty, rr->nx); tty_repeat_space(tty, nx);
}
}
} }
/* Draw a line from screen to tty. */ /* Draw a line from screen to tty. */

92
tty.c
View File

@@ -108,6 +108,7 @@ tty_init(struct tty *tty, struct client *c)
tty->cstyle = SCREEN_CURSOR_DEFAULT; tty->cstyle = SCREEN_CURSOR_DEFAULT;
tty->ccolour = -1; tty->ccolour = -1;
tty->fg = tty->bg = -1; tty->fg = tty->bg = -1;
tty->mouse_last_pane = -1;
if (tcgetattr(c->fd, &tty->tio) != 0) if (tcgetattr(c->fd, &tty->tio) != 0)
return (-1); return (-1);
@@ -1092,12 +1093,14 @@ tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx)
* If region is large, schedule a redraw. In most cases this is likely * If region is large, schedule a redraw. In most cases this is likely
* to be followed by some more scrolling. * to be followed by some more scrolling.
*/ */
if (tty_large_region(tty, ctx)) { if (tty_large_region(tty, ctx) && ~ctx->flags & TTY_CTX_PANE_OBSCURED) {
log_debug("%s: %s large redraw", __func__, c->name); log_debug("%s: %s large region redraw", __func__, c->name);
ctx->redraw_cb(ctx); ctx->redraw_cb(ctx);
return; return;
} }
log_debug("%s: %s small region redraw (%u-%u)", __func__, c->name,
ctx->orupper, ctx->orlower);
for (i = ctx->orupper; i <= ctx->orlower; i++) for (i = ctx->orupper; i <= ctx->orlower; i++)
tty_draw_pane(tty, ctx, i); tty_draw_pane(tty, ctx, i);
} }
@@ -1123,23 +1126,23 @@ static int
tty_clamp_line(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py, tty_clamp_line(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py,
u_int nx, u_int *i, u_int *x, u_int *rx, u_int *ry) u_int nx, u_int *i, u_int *x, u_int *rx, u_int *ry)
{ {
u_int xoff = ctx->rxoff + px; int xoff = ctx->rxoff + px;
if (!tty_is_visible(tty, ctx, px, py, nx, 1)) if (!tty_is_visible(tty, ctx, px, py, nx, 1))
return (0); return (0);
*ry = ctx->yoff + py - ctx->woy; *ry = ctx->yoff + py - ctx->woy;
if (xoff >= ctx->wox && xoff + nx <= ctx->wox + ctx->wsx) { if (xoff >= (int)ctx->wox && xoff + nx <= ctx->wox + ctx->wsx) {
/* All visible. */ /* All visible. */
*i = 0; *i = 0;
*x = ctx->xoff + px - ctx->wox; *x = ctx->xoff + px - ctx->wox;
*rx = nx; *rx = nx;
} else if (xoff < ctx->wox && xoff + nx > ctx->wox + ctx->wsx) { } else if (xoff < (int)ctx->wox && xoff + nx > ctx->wox + ctx->wsx) {
/* Both left and right not visible. */ /* Both left and right not visible. */
*i = ctx->wox; *i = ctx->wox;
*x = 0; *x = 0;
*rx = ctx->wsx; *rx = ctx->wsx;
} else if (xoff < ctx->wox) { } else if (xoff < (int)ctx->wox) {
/* Left not visible. */ /* Left not visible. */
*i = ctx->wox - (ctx->xoff + px); *i = ctx->wox - (ctx->xoff + px);
*x = 0; *x = 0;
@@ -1216,12 +1219,22 @@ tty_clear_pane_line(struct tty *tty, const struct tty_ctx *ctx, u_int py,
u_int px, u_int nx, u_int bg) u_int px, u_int nx, u_int bg)
{ {
struct client *c = tty->client; struct client *c = tty->client;
u_int i, x, rx, ry; struct visible_ranges *r;
struct visible_range *ri;
u_int i, l, x, rx, ry;
log_debug("%s: %s, %u at %u,%u", __func__, c->name, nx, px, py); log_debug("%s: %s, %u at %u,%u", __func__, c->name, nx, px, py);
if (tty_clamp_line(tty, ctx, px, py, nx, &i, &x, &rx, &ry)) if (tty_clamp_line(tty, ctx, px, py, nx, &l, &x, &rx, &ry)) {
tty_clear_line(tty, &ctx->defaults, ry, x, rx, bg); r = tty_check_overlay_range(tty, x, ry, rx);
for (i = 0; i < r->used; i++) {
ri = &r->ranges[i];
if (ri->nx == 0)
continue;
tty_clear_line(tty, &ctx->defaults, ry, ri->px, ri->nx,
bg);
}
}
} }
/* Clamp area position to visible part of pane. */ /* Clamp area position to visible part of pane. */
@@ -1288,10 +1301,11 @@ tty_clamp_area(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py,
/* Clear an area, adjusting to visible part of pane. */ /* Clear an area, adjusting to visible part of pane. */
static void static void
tty_clear_area(struct tty *tty, const struct grid_cell *defaults, u_int py, tty_clear_area(struct tty *tty, const struct tty_ctx *ctx, u_int py,
u_int ny, u_int px, u_int nx, u_int bg) u_int ny, u_int px, u_int nx, u_int bg)
{ {
struct client *c = tty->client; struct client *c = tty->client;
const struct grid_cell *defaults = &ctx->defaults;
u_int yy; u_int yy;
char tmp[64]; char tmp[64];
@@ -1301,7 +1315,10 @@ tty_clear_area(struct tty *tty, const struct grid_cell *defaults, u_int py,
if (nx == 0 || ny == 0) if (nx == 0 || ny == 0)
return; return;
/* If genuine BCE is available, can try escape sequences. */ /*
* If there is an overlay or BCE is not available, cannot clear as a
* region.
*/
if (c->overlay_check == NULL && !tty_fake_bce(tty, defaults, bg)) { if (c->overlay_check == NULL && !tty_fake_bce(tty, defaults, bg)) {
/* Use ED if clearing off the bottom of the terminal. */ /* Use ED if clearing off the bottom of the terminal. */
if (px == 0 && if (px == 0 &&
@@ -1366,9 +1383,10 @@ tty_clear_pane_area(struct tty *tty, const struct tty_ctx *ctx, u_int py,
u_int i, j, x, y, rx, ry; u_int i, j, x, y, rx, ry;
if (tty_clamp_area(tty, ctx, px, py, nx, ny, &i, &j, &x, &y, &rx, &ry)) if (tty_clamp_area(tty, ctx, px, py, nx, ny, &i, &j, &x, &y, &rx, &ry))
tty_clear_area(tty, &ctx->defaults, y, ry, x, rx, bg); tty_clear_area(tty, ctx, y, ry, x, rx, bg);
} }
/* Redraw a line of a screen at py. */
static void static void
tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py) tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py)
{ {
@@ -1404,6 +1422,7 @@ tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py)
} }
} }
/* Check if character needs to be mapped for codeset. */
const struct grid_cell * const struct grid_cell *
tty_check_codeset(struct tty *tty, const struct grid_cell *gc) tty_check_codeset(struct tty *tty, const struct grid_cell *gc)
{ {
@@ -1612,7 +1631,7 @@ tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct client *c = tty->client; struct client *c = tty->client;
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) || if ((ctx->flags & (TTY_CTX_WINDOW_BIGGER|TTY_CTX_PANE_OBSCURED)) ||
!tty_full_width(tty, ctx) || !tty_full_width(tty, ctx) ||
tty_fake_bce(tty, &ctx->defaults, ctx->bg) || tty_fake_bce(tty, &ctx->defaults, ctx->bg) ||
(!tty_term_has(tty->term, TTYC_ICH) && (!tty_term_has(tty->term, TTYC_ICH) &&
@@ -1635,7 +1654,7 @@ tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct client *c = tty->client; struct client *c = tty->client;
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) || if (ctx->flags & (TTY_CTX_WINDOW_BIGGER|TTY_CTX_PANE_OBSCURED) ||
!tty_full_width(tty, ctx) || !tty_full_width(tty, ctx) ||
tty_fake_bce(tty, &ctx->defaults, ctx->bg) || tty_fake_bce(tty, &ctx->defaults, ctx->bg) ||
(!tty_term_has(tty->term, TTYC_DCH) && (!tty_term_has(tty->term, TTYC_DCH) &&
@@ -1667,7 +1686,7 @@ tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct client *c = tty->client; struct client *c = tty->client;
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) || if ((ctx->flags & (TTY_CTX_WINDOW_BIGGER|TTY_CTX_PANE_OBSCURED)) ||
!tty_full_width(tty, ctx) || !tty_full_width(tty, ctx) ||
tty_fake_bce(tty, &ctx->defaults, ctx->bg) || tty_fake_bce(tty, &ctx->defaults, ctx->bg) ||
!tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_CSR) ||
@@ -1695,7 +1714,7 @@ tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct client *c = tty->client; struct client *c = tty->client;
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) || if (ctx->flags & (TTY_CTX_WINDOW_BIGGER|TTY_CTX_PANE_OBSCURED) ||
!tty_full_width(tty, ctx) || !tty_full_width(tty, ctx) ||
tty_fake_bce(tty, &ctx->defaults, ctx->bg) || tty_fake_bce(tty, &ctx->defaults, ctx->bg) ||
!tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_CSR) ||
@@ -1755,7 +1774,7 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
if (ctx->ocy != ctx->orupper) if (ctx->ocy != ctx->orupper)
return; return;
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) || if (ctx->flags & (TTY_CTX_WINDOW_BIGGER|TTY_CTX_PANE_OBSCURED) ||
(!tty_full_width(tty, ctx) && !tty_use_margin(tty)) || (!tty_full_width(tty, ctx) && !tty_use_margin(tty)) ||
tty_fake_bce(tty, &ctx->defaults, 8) || tty_fake_bce(tty, &ctx->defaults, 8) ||
!tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_CSR) ||
@@ -1830,7 +1849,7 @@ tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx)
struct client *c = tty->client; struct client *c = tty->client;
u_int i; u_int i;
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) || if (ctx->flags & (TTY_CTX_WINDOW_BIGGER|TTY_CTX_PANE_OBSCURED) ||
(!tty_full_width(tty, ctx) && !tty_use_margin(tty)) || (!tty_full_width(tty, ctx) && !tty_use_margin(tty)) ||
tty_fake_bce(tty, &ctx->defaults, 8) || tty_fake_bce(tty, &ctx->defaults, 8) ||
!tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_CSR) ||
@@ -1869,7 +1888,7 @@ tty_cmd_scrolldown(struct tty *tty, const struct tty_ctx *ctx)
u_int i; u_int i;
struct client *c = tty->client; struct client *c = tty->client;
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) || if (ctx->flags & (TTY_CTX_WINDOW_BIGGER|TTY_CTX_PANE_OBSCURED) ||
(!tty_full_width(tty, ctx) && !tty_use_margin(tty)) || (!tty_full_width(tty, ctx) && !tty_use_margin(tty)) ||
tty_fake_bce(tty, &ctx->defaults, 8) || tty_fake_bce(tty, &ctx->defaults, 8) ||
!tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_CSR) ||
@@ -1969,9 +1988,11 @@ tty_cmd_clearscreen(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_alignmenttest(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_alignmenttest(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct client *c = tty->client;
u_int i, j; u_int i, j;
if (ctx->flags & TTY_CTX_WINDOW_BIGGER) { if (ctx->flags & (TTY_CTX_WINDOW_BIGGER|TTY_CTX_PANE_OBSCURED) ||
c->overlay_check != NULL) {
ctx->redraw_cb(ctx); ctx->redraw_cb(ctx);
return; return;
} }
@@ -2040,7 +2061,7 @@ void
tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct visible_ranges *r; struct visible_ranges *r;
struct visible_range *rr; struct visible_range *ri;
u_int i, px, py, cx; u_int i, px, py, cx;
const char *cp = ctx->data.data; const char *cp = ctx->data.data;
size_t n = ctx->data.size; size_t n = ctx->data.size;
@@ -2075,11 +2096,11 @@ tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx)
r = tty_check_overlay_range(tty, px, py, n); r = tty_check_overlay_range(tty, px, py, n);
for (i = 0; i < r->used; i++) { for (i = 0; i < r->used; i++) {
rr = &r->ranges[i]; ri = &r->ranges[i];
if (rr->nx != 0) { if (ri->nx != 0) {
cx = rr->px - ctx->xoff + ctx->wox; cx = ri->px - ctx->xoff + ctx->wox;
tty_cursor_pane_unless_wrap(tty, ctx, cx, ctx->ocy); tty_cursor_pane_unless_wrap(tty, ctx, cx, ctx->ocy);
tty_putn(tty, cp + rr->px - px, rr->nx, rr->nx); tty_putn(tty, cp + ri->px - px, ri->nx, ri->nx);
} }
} }
} }
@@ -2211,6 +2232,10 @@ tty_cell(struct tty *tty, const struct grid_cell *gc,
if (gc->flags & GRID_FLAG_PADDING) if (gc->flags & GRID_FLAG_PADDING)
return; return;
/* Check if character is covered by overlay or floating pane. */
if (!tty_check_overlay(tty, tty->cx, tty->cy))
return;
/* Check the output codeset and apply attributes. */ /* Check the output codeset and apply attributes. */
gcp = tty_check_codeset(tty, gc); gcp = tty_check_codeset(tty, gc);
tty_attributes(tty, gcp, defaults, palette, hl); tty_attributes(tty, gcp, defaults, palette, hl);
@@ -2324,8 +2349,21 @@ tty_margin_off(struct tty *tty)
static void static void
tty_margin_pane(struct tty *tty, const struct tty_ctx *ctx) tty_margin_pane(struct tty *tty, const struct tty_ctx *ctx)
{ {
tty_margin(tty, ctx->xoff - ctx->wox, int l, r;
ctx->xoff + ctx->sx - 1 - ctx->wox);
l = ctx->xoff - ctx->wox;
r = ctx->xoff + ctx->sx - 1 - ctx->wox;
if (l < 0)
l = 0;
if (l > (int)ctx->wsx)
l = ctx->wsx;
if (r < 0)
r = 0;
if (r > (int)ctx->wsx)
r = ctx->wsx;
tty_margin(tty, l, r);
} }
/* Set margin at absolute position. */ /* Set margin at absolute position. */