mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
When checking ranges in tty_cmd_cells, cannot use the tty cursor
position and tty_cursor because it may be at the final invisible cursor position on automargin terminals. The text to be drawn is confined to the pane, so use the pane cursor position for the checks instead. Fix from Anindya Mukherjee, redraw problem reported by naddy@.
This commit is contained in:
parent
837ca176d1
commit
d0ab1a837a
21
tty.c
21
tty.c
@ -1993,8 +1993,9 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
|
||||
void
|
||||
tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx)
|
||||
{
|
||||
struct overlay_ranges r;
|
||||
u_int i, px;
|
||||
struct overlay_ranges r;
|
||||
u_int i, px, py, cx;
|
||||
char *cp = ctx->ptr;
|
||||
|
||||
if (!tty_is_visible(tty, ctx, ctx->ocx, ctx->ocy, ctx->num, 1))
|
||||
return;
|
||||
@ -2017,16 +2018,20 @@ tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx)
|
||||
|
||||
tty_margin_off(tty);
|
||||
tty_cursor_pane_unless_wrap(tty, ctx, ctx->ocx, ctx->ocy);
|
||||
|
||||
tty_attributes(tty, ctx->cell, &ctx->defaults, ctx->palette);
|
||||
px = tty->cx;
|
||||
tty_check_overlay_range(tty, px, tty->cy, ctx->num, &r);
|
||||
|
||||
/* Get tty position from pane position for overlay check. */
|
||||
px = ctx->xoff + ctx->ocx - ctx->wox;
|
||||
py = ctx->yoff + ctx->ocy - ctx->woy;
|
||||
|
||||
tty_check_overlay_range(tty, px, py, ctx->num, &r);
|
||||
for (i = 0; i < OVERLAY_MAX_RANGES; i++) {
|
||||
if (r.nx[i] == 0)
|
||||
continue;
|
||||
tty_cursor(tty, r.px[i], tty->cy);
|
||||
tty_putn(tty, (char *)ctx->ptr + r.px[i] - px, r.nx[i],
|
||||
r.nx[i]);
|
||||
/* Convert back to pane position for printing. */
|
||||
cx = r.px[i] - ctx->xoff + ctx->wox;
|
||||
tty_cursor_pane_unless_wrap(tty, ctx, cx, ctx->ocy);
|
||||
tty_putn(tty, cp + r.px[i] - px, r.nx[i], r.nx[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user