Calculate size when trimming RHS correctly.

pull/1487/head
Nicholas Marriott 2018-09-24 12:17:29 +01:00
parent 71d2ab184b
commit ad71e7f9d2
2 changed files with 22 additions and 7 deletions

View File

@ -368,7 +368,7 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
/* Right not visible. */
i = 0;
x = xoff - ctx->ox;
width = size - (xoff + size - ctx->sx);
width = size - x;
}
if (ctx->top)
@ -628,7 +628,7 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
/* Right not visible. */
i = 0;
x = wp->xoff - ctx->ox;
width = wp->sx - (wp->xoff + wp->sx - ctx->sx);
width = ctx->sx - x;
}
log_debug("%s: %s %%%u line %u,%u at %u,%u, width %u",
__func__, c->name, wp->id, i, j, x, y, width);
@ -674,7 +674,7 @@ screen_redraw_draw_number(struct screen_redraw_ctx *ctx, struct window_pane *wp)
} else {
/* Right not visible. */
xoff = wp->xoff - ctx->ox;
sx = wp->sx - (wp->xoff + wp->sx - ctx->sx);
sx = wp->sx - xoff;
}
if (wp->yoff >= ctx->oy && wp->yoff + wp->sy <= ctx->oy + ctx->sy) {
/* All visible. */
@ -692,7 +692,7 @@ screen_redraw_draw_number(struct screen_redraw_ctx *ctx, struct window_pane *wp)
} else {
/* Bottom not visible. */
yoff = wp->yoff - ctx->oy;
sy = wp->sy - (wp->yoff + wp->sy - ctx->sy);
sy = wp->sy - yoff;
}
if (ctx->top)

21
tty.c
View File

@ -936,8 +936,13 @@ tty_clamp_line(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py,
/* Right not visible. */
*i = 0;
*x = (ctx->xoff + px) - ctx->ox;
*rx = nx - ((ctx->xoff + px) + nx - ctx->sx);
*rx = ctx->sx - *x;
}
if (*rx > nx)
fatalx("%s: x too big, %u > %u", __func__, *rx, nx);
if (nx > *rx)
*rx = nx;
return (1);
}
@ -1028,8 +1033,13 @@ tty_clamp_area(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py,
/* Right not visible. */
*i = 0;
*x = (ctx->xoff + px) - ctx->ox;
*rx = nx - ((ctx->xoff + px) + nx - ctx->sx);
*rx = ctx->sx - *x;
}
if (*rx > nx)
fatalx("%s: x too big, %u > %u", __func__, *rx, nx);
if (nx > *rx)
*rx = nx;
if (yoff >= ctx->oy && yoff + ny <= ctx->oy + ctx->sy) {
/* All visible. */
*j = 0;
@ -1049,8 +1059,13 @@ tty_clamp_area(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py,
/* Right not visible. */
*j = 0;
*y = (ctx->yoff + py) - ctx->oy;
*ry = ny - ((ctx->yoff + py) + ny - ctx->sy);
*ry = ctx->sy - *y;
}
if (*ry > ny)
fatalx("%s: y too big, %u > %u", __func__, *ry, ny);
if (ny > *ry)
*ry = ny;
return (1);
}