mirror of
https://github.com/tmux/tmux.git
synced 2026-05-31 14:46:17 +00:00
Use a flags bit for obscured rather than an int.
This commit is contained in:
148
screen-write.c
148
screen-write.c
@@ -36,7 +36,6 @@ static int screen_write_overwrite(struct screen_write_ctx *,
|
|||||||
struct grid_cell *, u_int);
|
struct grid_cell *, u_int);
|
||||||
static int screen_write_combine(struct screen_write_ctx *,
|
static int screen_write_combine(struct screen_write_ctx *,
|
||||||
const struct grid_cell *);
|
const struct grid_cell *);
|
||||||
static int screen_write_pane_is_obscured(struct screen_write_ctx *);
|
|
||||||
|
|
||||||
struct screen_write_citem {
|
struct screen_write_citem {
|
||||||
u_int x;
|
u_int x;
|
||||||
@@ -176,10 +175,43 @@ screen_write_set_client_cb(struct tty_ctx *ttyctx, struct client *c)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return 1 if there is a floating window pane overlapping this pane. */
|
||||||
|
static int
|
||||||
|
screen_write_pane_is_obscured(struct screen_write_ctx *ctx)
|
||||||
|
{
|
||||||
|
struct window_pane *wp = ctx->wp;
|
||||||
|
|
||||||
|
if (ctx->wp == NULL)
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
if (ctx->flags & SCREEN_WRITE_CHECKED_IF_OBSCURED) {
|
||||||
|
if (ctx->flags & SCREEN_WRITE_OBSCURED)
|
||||||
|
return (1);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
ctx->flags |= SCREEN_WRITE_CHECKED_IF_OBSCURED;
|
||||||
|
|
||||||
|
while ((wp = TAILQ_PREV(wp, window_panes, zentry)) != NULL) {
|
||||||
|
if ((wp->flags & PANE_FLOATING) &&
|
||||||
|
((wp->yoff >= ctx->wp->yoff &&
|
||||||
|
wp->yoff <= ctx->wp->yoff + (int)ctx->wp->sy) ||
|
||||||
|
(wp->yoff + (int)wp->sy >= ctx->wp->yoff &&
|
||||||
|
wp->yoff + wp->sy <= ctx->wp->yoff + ctx->wp->sy)) &&
|
||||||
|
((wp->xoff >= ctx->wp->xoff &&
|
||||||
|
wp->xoff <= ctx->wp->xoff + (int)ctx->wp->sx) ||
|
||||||
|
(wp->xoff + (int)wp->sx >= ctx->wp->xoff &&
|
||||||
|
wp->xoff + wp->sx <= ctx->wp->xoff + ctx->wp->sx))) {
|
||||||
|
ctx->flags |= SCREEN_WRITE_OBSCURED;
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set up context for TTY command. */
|
/* Set up context for TTY command. */
|
||||||
static void
|
static void
|
||||||
screen_write_initctx(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx,
|
screen_write_initctx(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx,
|
||||||
int sync)
|
int is_sync, int check_obscured)
|
||||||
{
|
{
|
||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
|
|
||||||
@@ -194,6 +226,9 @@ screen_write_initctx(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx,
|
|||||||
ttyctx->orlower = s->rlower;
|
ttyctx->orlower = s->rlower;
|
||||||
ttyctx->orupper = s->rupper;
|
ttyctx->orupper = s->rupper;
|
||||||
|
|
||||||
|
if (check_obscured && screen_write_pane_is_obscured(ctx))
|
||||||
|
ttyctx->flags |= TTY_CTX_PANE_OBSCURED;
|
||||||
|
|
||||||
memcpy(&ttyctx->defaults, &grid_default_cell, sizeof ttyctx->defaults);
|
memcpy(&ttyctx->defaults, &grid_default_cell, sizeof ttyctx->defaults);
|
||||||
if (ctx->init_ctx_cb != NULL) {
|
if (ctx->init_ctx_cb != NULL) {
|
||||||
ctx->init_ctx_cb(ctx, ttyctx);
|
ctx->init_ctx_cb(ctx, ttyctx);
|
||||||
@@ -225,7 +260,7 @@ screen_write_initctx(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx,
|
|||||||
else {
|
else {
|
||||||
if (ctx->wp == NULL)
|
if (ctx->wp == NULL)
|
||||||
ttyctx->flags |= TTY_CTX_OVERLAY_SYNC;
|
ttyctx->flags |= TTY_CTX_OVERLAY_SYNC;
|
||||||
if (sync)
|
if (is_sync)
|
||||||
ttyctx->flags |= TTY_CTX_SYNC;
|
ttyctx->flags |= TTY_CTX_SYNC;
|
||||||
}
|
}
|
||||||
tty_write(tty_cmd_syncstart, ttyctx);
|
tty_write(tty_cmd_syncstart, ttyctx);
|
||||||
@@ -593,10 +628,9 @@ screen_write_fast_copy(struct screen_write_ctx *ctx, struct screen *src,
|
|||||||
if (yy >= gd->hsize + gd->sy)
|
if (yy >= gd->hsize + gd->sy)
|
||||||
break;
|
break;
|
||||||
s->cx = cx;
|
s->cx = cx;
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
screen_write_initctx(ctx, &ttyctx, 0, 0);
|
||||||
if (wp != NULL) {
|
if (wp != NULL)
|
||||||
yoff = wp->yoff;
|
yoff = wp->yoff;
|
||||||
}
|
|
||||||
r = screen_redraw_get_visible_ranges(wp, px, s->cy + yoff, nx,
|
r = screen_redraw_get_visible_ranges(wp, px, s->cy + yoff, nx,
|
||||||
NULL);
|
NULL);
|
||||||
for (xx = px; xx < px + nx; xx++) {
|
for (xx = px; xx < px + nx; xx++) {
|
||||||
@@ -1104,7 +1138,7 @@ screen_write_alignmenttest(struct screen_write_ctx *ctx)
|
|||||||
s->rupper = 0;
|
s->rupper = 0;
|
||||||
s->rlower = screen_size_y(s) - 1;
|
s->rlower = screen_size_y(s) - 1;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||||
|
|
||||||
screen_write_collect_clear(ctx, 0, screen_size_y(s) - 1);
|
screen_write_collect_clear(ctx, 0, screen_size_y(s) - 1);
|
||||||
tty_write(tty_cmd_alignmenttest, &ttyctx);
|
tty_write(tty_cmd_alignmenttest, &ttyctx);
|
||||||
@@ -1133,9 +1167,8 @@ screen_write_insertcharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
|
|||||||
ctx->wp->flags |= PANE_REDRAW;
|
ctx->wp->flags |= PANE_REDRAW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
screen_write_initctx(ctx, &ttyctx, 0, 1);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
ttyctx.obscured = screen_write_pane_is_obscured(ctx);
|
|
||||||
|
|
||||||
grid_view_insert_cells(s->grid, s->cx, s->cy, nx, bg);
|
grid_view_insert_cells(s->grid, s->cx, s->cy, nx, bg);
|
||||||
|
|
||||||
@@ -1167,9 +1200,8 @@ screen_write_deletecharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
|
|||||||
ctx->wp->flags |= PANE_REDRAW;
|
ctx->wp->flags |= PANE_REDRAW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
screen_write_initctx(ctx, &ttyctx, 0, 1);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
ttyctx.obscured = screen_write_pane_is_obscured(ctx);
|
|
||||||
|
|
||||||
grid_view_delete_cells(s->grid, s->cx, s->cy, nx, bg);
|
grid_view_delete_cells(s->grid, s->cx, s->cy, nx, bg);
|
||||||
|
|
||||||
@@ -1201,7 +1233,7 @@ screen_write_clearcharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
|
|||||||
ctx->wp->flags |= PANE_REDRAW;
|
ctx->wp->flags |= PANE_REDRAW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
screen_write_initctx(ctx, &ttyctx, 0, 0);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
grid_view_clear(s->grid, s->cx, s->cy, nx, 1, bg);
|
grid_view_clear(s->grid, s->cx, s->cy, nx, 1, bg);
|
||||||
@@ -1237,9 +1269,8 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
|||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
ttyctx.obscured = screen_write_pane_is_obscured(ctx);
|
|
||||||
|
|
||||||
grid_view_insert_lines(gd, s->cy, ny, bg);
|
grid_view_insert_lines(gd, s->cy, ny, bg);
|
||||||
|
|
||||||
@@ -1254,11 +1285,8 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
|||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
ttyctx.obscured = screen_write_pane_is_obscured(ctx);
|
|
||||||
log_debug("%s: obscured=%d for pane %%%u", __func__,
|
|
||||||
ttyctx.obscured, ctx->wp != NULL ? ctx->wp->id : 0);
|
|
||||||
|
|
||||||
if (s->cy < s->rupper || s->cy > s->rlower)
|
if (s->cy < s->rupper || s->cy > s->rlower)
|
||||||
grid_view_insert_lines(gd, s->cy, ny, bg);
|
grid_view_insert_lines(gd, s->cy, ny, bg);
|
||||||
@@ -1294,9 +1322,8 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
|||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
ttyctx.obscured = screen_write_pane_is_obscured(ctx);
|
|
||||||
|
|
||||||
grid_view_delete_lines(gd, s->cy, ny, bg);
|
grid_view_delete_lines(gd, s->cy, ny, bg);
|
||||||
|
|
||||||
@@ -1311,11 +1338,8 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
|||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
ttyctx.obscured = screen_write_pane_is_obscured(ctx);
|
|
||||||
log_debug("%s: obscured=%d for pane %%%u", __func__,
|
|
||||||
ttyctx.obscured, ctx->wp != NULL ? ctx->wp->id : 0);
|
|
||||||
|
|
||||||
if (s->cy < s->rupper || s->cy > s->rlower)
|
if (s->cy < s->rupper || s->cy > s->rlower)
|
||||||
grid_view_delete_lines(gd, s->cy, ny, bg);
|
grid_view_delete_lines(gd, s->cy, ny, bg);
|
||||||
@@ -1474,7 +1498,7 @@ screen_write_reverseindex(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
grid_view_scroll_region_down(s->grid, s->rupper, s->rlower, bg);
|
grid_view_scroll_region_down(s->grid, s->rupper, s->rlower, bg);
|
||||||
screen_write_collect_flush(ctx, 0, __func__);
|
screen_write_collect_flush(ctx, 0, __func__);
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 0);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
tty_write(tty_cmd_reverseindex, &ttyctx);
|
tty_write(tty_cmd_reverseindex, &ttyctx);
|
||||||
@@ -1585,9 +1609,8 @@ screen_write_scrolldown(struct screen_write_ctx *ctx, u_int lines, u_int bg)
|
|||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
ttyctx.obscured = screen_write_pane_is_obscured(ctx);
|
|
||||||
|
|
||||||
if (lines == 0)
|
if (lines == 0)
|
||||||
lines = 1;
|
lines = 1;
|
||||||
@@ -1631,7 +1654,7 @@ screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
ctx->wp->flags |= PANE_REDRAW;
|
ctx->wp->flags |= PANE_REDRAW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
/* Scroll into history if it is enabled and clearing entire screen. */
|
/* Scroll into history if it is enabled and clearing entire screen. */
|
||||||
@@ -1650,7 +1673,7 @@ screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
screen_write_collect_clear(ctx, s->cy + 1, sy - (s->cy + 1));
|
screen_write_collect_clear(ctx, s->cy + 1, sy - (s->cy + 1));
|
||||||
screen_write_collect_flush(ctx, 0, __func__);
|
screen_write_collect_flush(ctx, 0, __func__);
|
||||||
|
|
||||||
if (!screen_write_pane_is_obscured(ctx)) {
|
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) {
|
||||||
tty_write(tty_cmd_clearendofscreen, &ttyctx);
|
tty_write(tty_cmd_clearendofscreen, &ttyctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1713,7 +1736,7 @@ screen_write_clearstartofscreen(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
ctx->wp->flags |= PANE_REDRAW;
|
ctx->wp->flags |= PANE_REDRAW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
if (s->cy > 0)
|
if (s->cy > 0)
|
||||||
@@ -1726,7 +1749,7 @@ screen_write_clearstartofscreen(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
screen_write_collect_clear(ctx, 0, s->cy);
|
screen_write_collect_clear(ctx, 0, s->cy);
|
||||||
screen_write_collect_flush(ctx, 0, __func__);
|
screen_write_collect_flush(ctx, 0, __func__);
|
||||||
|
|
||||||
if (!screen_write_pane_is_obscured(ctx)) {
|
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) {
|
||||||
tty_write(tty_cmd_clearstartofscreen, &ttyctx);
|
tty_write(tty_cmd_clearstartofscreen, &ttyctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1787,7 +1810,7 @@ screen_write_clearscreen(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
ctx->wp->flags |= PANE_REDRAW;
|
ctx->wp->flags |= PANE_REDRAW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
/* Scroll into history if it is enabled. */
|
/* Scroll into history if it is enabled. */
|
||||||
@@ -1800,7 +1823,7 @@ screen_write_clearscreen(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
|
|
||||||
screen_write_collect_clear(ctx, 0, sy);
|
screen_write_collect_clear(ctx, 0, sy);
|
||||||
|
|
||||||
if (!screen_write_pane_is_obscured(ctx)) {
|
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) {
|
||||||
tty_write(tty_cmd_clearscreen, &ttyctx);
|
tty_write(tty_cmd_clearscreen, &ttyctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1848,7 +1871,7 @@ screen_write_fullredraw(struct screen_write_ctx *ctx)
|
|||||||
|
|
||||||
screen_write_collect_flush(ctx, 0, __func__);
|
screen_write_collect_flush(ctx, 0, __func__);
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 0);
|
||||||
if (ttyctx.redraw_cb != NULL)
|
if (ttyctx.redraw_cb != NULL)
|
||||||
ttyctx.redraw_cb(&ttyctx);
|
ttyctx.redraw_cb(&ttyctx);
|
||||||
}
|
}
|
||||||
@@ -1985,39 +2008,6 @@ screen_write_collect_scroll(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
TAILQ_INSERT_TAIL(&ctx->s->write_list[s->rlower].items, ci, entry);
|
TAILQ_INSERT_TAIL(&ctx->s->write_list[s->rlower].items, ci, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return 1 if there is a floating window pane overlapping this pane. */
|
|
||||||
static int
|
|
||||||
screen_write_pane_is_obscured(struct screen_write_ctx *ctx)
|
|
||||||
{
|
|
||||||
struct window_pane *wp = ctx->wp;
|
|
||||||
|
|
||||||
if (ctx->wp == NULL)
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
if (ctx->flags & SCREEN_WRITE_CHECKED_IF_OBSCURED) {
|
|
||||||
if (ctx->flags & SCREEN_WRITE_OBSCURED)
|
|
||||||
return (1);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
ctx->flags |= SCREEN_WRITE_CHECKED_IF_OBSCURED;
|
|
||||||
|
|
||||||
while ((wp = TAILQ_PREV(wp, window_panes, zentry)) != NULL) {
|
|
||||||
if ((wp->flags & PANE_FLOATING) &&
|
|
||||||
((wp->yoff >= ctx->wp->yoff &&
|
|
||||||
wp->yoff <= ctx->wp->yoff + (int)ctx->wp->sy) ||
|
|
||||||
(wp->yoff + (int)wp->sy >= ctx->wp->yoff &&
|
|
||||||
wp->yoff + wp->sy <= ctx->wp->yoff + ctx->wp->sy)) &&
|
|
||||||
((wp->xoff >= ctx->wp->xoff &&
|
|
||||||
wp->xoff <= ctx->wp->xoff + (int)ctx->wp->sx) ||
|
|
||||||
(wp->xoff + (int)wp->sx >= ctx->wp->xoff &&
|
|
||||||
wp->xoff + wp->sx <= ctx->wp->xoff + ctx->wp->sx))) {
|
|
||||||
ctx->flags |= SCREEN_WRITE_OBSCURED;
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Flush collected lines. */
|
/* Flush collected lines. */
|
||||||
static void
|
static void
|
||||||
screen_write_collect_flush(struct screen_write_ctx *ctx, int scroll_only,
|
screen_write_collect_flush(struct screen_write_ctx *ctx, int scroll_only,
|
||||||
@@ -2053,14 +2043,11 @@ screen_write_collect_flush(struct screen_write_ctx *ctx, int scroll_only,
|
|||||||
if (ctx->scrolled > s->rlower - s->rupper + 1)
|
if (ctx->scrolled > s->rlower - s->rupper + 1)
|
||||||
ctx->scrolled = s->rlower - s->rupper + 1;
|
ctx->scrolled = s->rlower - s->rupper + 1;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||||
if (wp != NULL && wp->yoff + wp->sy > wp->window->sy)
|
if (wp != NULL && wp->yoff + wp->sy > wp->window->sy)
|
||||||
ttyctx.orlower -= (wp->yoff + wp->sy - wp->window->sy);
|
ttyctx.orlower -= (wp->yoff + wp->sy - wp->window->sy);
|
||||||
ttyctx.num = ctx->scrolled;
|
ttyctx.num = ctx->scrolled;
|
||||||
ttyctx.bg = ctx->bg;
|
ttyctx.bg = ctx->bg;
|
||||||
ttyctx.obscured = screen_write_pane_is_obscured(ctx);
|
|
||||||
log_debug("%s: obscured=%d for pane %%%u", __func__,
|
|
||||||
ttyctx.obscured, wp != NULL ? wp->id : 0);
|
|
||||||
tty_write(tty_cmd_scrollup, &ttyctx);
|
tty_write(tty_cmd_scrollup, &ttyctx);
|
||||||
if (wp != NULL)
|
if (wp != NULL)
|
||||||
log_debug("%s: after scrollup, PANE_REDRAW=%d for %%%u",
|
log_debug("%s: after scrollup, PANE_REDRAW=%d for %%%u",
|
||||||
@@ -2147,15 +2134,16 @@ screen_write_collect_flush(struct screen_write_ctx *ctx, int scroll_only,
|
|||||||
continue;
|
continue;
|
||||||
screen_write_set_cursor(ctx, wr_start, y);
|
screen_write_set_cursor(ctx, wr_start, y);
|
||||||
if (ci->type == CLEAR) {
|
if (ci->type == CLEAR) {
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 0);
|
||||||
ttyctx.bg = ci->bg;
|
ttyctx.bg = ci->bg;
|
||||||
ttyctx.num = wr_length;
|
ttyctx.num = wr_length;
|
||||||
tty_write(tty_cmd_clearcharacter,
|
tty_write(tty_cmd_clearcharacter,
|
||||||
&ttyctx);
|
&ttyctx);
|
||||||
} else {
|
} else {
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
screen_write_initctx(ctx, &ttyctx, 0, 0);
|
||||||
ttyctx.cell = &ci->gc;
|
ttyctx.cell = &ci->gc;
|
||||||
ttyctx.wrapped = ci->wrapped;
|
if (ci->wrapped)
|
||||||
|
ttyctx.flags |= TTY_CTX_WRAPPED;
|
||||||
ttyctx.ptr = cl->data + wr_start;
|
ttyctx.ptr = cl->data + wr_start;
|
||||||
ttyctx.num = wr_length;
|
ttyctx.num = wr_length;
|
||||||
tty_write(tty_cmd_cells, &ttyctx);
|
tty_write(tty_cmd_cells, &ttyctx);
|
||||||
@@ -2382,7 +2370,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
/* Sanity check cursor position. */
|
/* Sanity check cursor position. */
|
||||||
if (s->cx > sx - width || s->cy > sy - 1)
|
if (s->cx > sx - width || s->cy > sy - 1)
|
||||||
return;
|
return;
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
screen_write_initctx(ctx, &ttyctx, 0, 0);
|
||||||
|
|
||||||
/* Handle overwriting of UTF-8 characters. */
|
/* Handle overwriting of UTF-8 characters. */
|
||||||
gl = grid_get_line(s->grid, s->grid->hsize + s->cy);
|
gl = grid_get_line(s->grid, s->grid->hsize + s->cy);
|
||||||
@@ -2622,7 +2610,7 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
* and what it is going to do now.
|
* and what it is going to do now.
|
||||||
*/
|
*/
|
||||||
screen_write_set_cursor(ctx, cx - n, cy);
|
screen_write_set_cursor(ctx, cx - n, cy);
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
screen_write_initctx(ctx, &ttyctx, 0, 0);
|
||||||
ttyctx.cell = &last;
|
ttyctx.cell = &last;
|
||||||
if (force_wide)
|
if (force_wide)
|
||||||
ttyctx.flags |= TTY_CTX_CELL_INVALIDATE;
|
ttyctx.flags |= TTY_CTX_CELL_INVALIDATE;
|
||||||
@@ -2711,7 +2699,7 @@ screen_write_setselection(struct screen_write_ctx *ctx, const char *clip,
|
|||||||
{
|
{
|
||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
screen_write_initctx(ctx, &ttyctx, 0, 0);
|
||||||
ttyctx.ptr = str;
|
ttyctx.ptr = str;
|
||||||
ttyctx.ptr2 = (void *)clip;
|
ttyctx.ptr2 = (void *)clip;
|
||||||
ttyctx.num = len;
|
ttyctx.num = len;
|
||||||
@@ -2726,7 +2714,7 @@ screen_write_rawstring(struct screen_write_ctx *ctx, u_char *str, u_int len,
|
|||||||
{
|
{
|
||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
screen_write_initctx(ctx, &ttyctx, 0, 0);
|
||||||
if (allow_invisible_panes)
|
if (allow_invisible_panes)
|
||||||
ttyctx.flags |= TTY_CTX_INVISIBLE_PANES;
|
ttyctx.flags |= TTY_CTX_INVISIBLE_PANES;
|
||||||
ttyctx.ptr = str;
|
ttyctx.ptr = str;
|
||||||
@@ -2814,7 +2802,7 @@ screen_write_alternateon(struct screen_write_ctx *ctx, struct grid_cell *gc,
|
|||||||
server_redraw_window_borders(wp->window);
|
server_redraw_window_borders(wp->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 0);
|
||||||
if (ttyctx.redraw_cb != NULL)
|
if (ttyctx.redraw_cb != NULL)
|
||||||
ttyctx.redraw_cb(&ttyctx);
|
ttyctx.redraw_cb(&ttyctx);
|
||||||
}
|
}
|
||||||
@@ -2838,7 +2826,7 @@ screen_write_alternateoff(struct screen_write_ctx *ctx, struct grid_cell *gc,
|
|||||||
server_redraw_window_borders(wp->window);
|
server_redraw_window_borders(wp->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 1);
|
screen_write_initctx(ctx, &ttyctx, 1, 0);
|
||||||
if (ttyctx.redraw_cb != NULL)
|
if (ttyctx.redraw_cb != NULL)
|
||||||
ttyctx.redraw_cb(&ttyctx);
|
ttyctx.redraw_cb(&ttyctx);
|
||||||
}
|
}
|
||||||
|
|||||||
4
tmux.h
4
tmux.h
@@ -1751,6 +1751,7 @@ struct tty_ctx {
|
|||||||
#define TTY_CTX_OVERLAY_SYNC 0x10
|
#define TTY_CTX_OVERLAY_SYNC 0x10
|
||||||
#define TTY_CTX_CELL_DRAW_LINE 0x20
|
#define TTY_CTX_CELL_DRAW_LINE 0x20
|
||||||
#define TTY_CTX_CELL_INVALIDATE 0x40
|
#define TTY_CTX_CELL_INVALIDATE 0x40
|
||||||
|
#define TTY_CTX_PANE_OBSCURED 0x80
|
||||||
|
|
||||||
u_int num;
|
u_int num;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
@@ -1787,9 +1788,6 @@ struct tty_ctx {
|
|||||||
u_int woy;
|
u_int woy;
|
||||||
u_int wsx;
|
u_int wsx;
|
||||||
u_int wsy;
|
u_int wsy;
|
||||||
|
|
||||||
/* tty partly obscured, it will need to be surgically scrolled. */
|
|
||||||
u_int obscured;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Saved message entry. */
|
/* Saved message entry. */
|
||||||
|
|||||||
36
tty.c
36
tty.c
@@ -1099,7 +1099,7 @@ tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
log_debug("%s: %s orlower=%u orupper=%u sy=%u large=%d", __func__,
|
log_debug("%s: %s orlower=%u orupper=%u sy=%u large=%d", __func__,
|
||||||
c->name, ctx->orlower, ctx->orupper, ctx->sy,
|
c->name, ctx->orlower, ctx->orupper, ctx->sy,
|
||||||
tty_large_region(tty, ctx));
|
tty_large_region(tty, ctx));
|
||||||
if (tty_large_region(tty, ctx) && !ctx->obscured) {
|
if (tty_large_region(tty, ctx) && ~ctx->flags & TTY_CTX_PANE_OBSCURED) {
|
||||||
log_debug("%s: %s large region redraw", __func__, c->name);
|
log_debug("%s: %s large region redraw", __func__, c->name);
|
||||||
ctx->redraw_cb(ctx);
|
ctx->redraw_cb(ctx);
|
||||||
return;
|
return;
|
||||||
@@ -1433,7 +1433,7 @@ tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py)
|
|||||||
|
|
||||||
if (~ctx->flags & TTY_CTX_WINDOW_BIGGER) {
|
if (~ctx->flags & TTY_CTX_WINDOW_BIGGER) {
|
||||||
if (wp) {
|
if (wp) {
|
||||||
if (ctx->obscured) {
|
if (ctx->flags & TTY_CTX_PANE_OBSCURED) {
|
||||||
/*
|
/*
|
||||||
* Floating pane is present: use physical
|
* Floating pane is present: use physical
|
||||||
* coordinates and clip to visible ranges to
|
* coordinates and clip to visible ranges to
|
||||||
@@ -1693,13 +1693,12 @@ 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) &&
|
||||||
!tty_term_has(tty->term, TTYC_ICH1)) ||
|
!tty_term_has(tty->term, TTYC_ICH1)) ||
|
||||||
c->overlay_check != NULL ||
|
c->overlay_check != NULL) {
|
||||||
ctx->obscured) {
|
|
||||||
tty_draw_pane(tty, ctx, ctx->ocy);
|
tty_draw_pane(tty, ctx, ctx->ocy);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1717,13 +1716,12 @@ 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) &&
|
||||||
!tty_term_has(tty->term, TTYC_DCH1)) ||
|
!tty_term_has(tty->term, TTYC_DCH1)) ||
|
||||||
c->overlay_check != NULL ||
|
c->overlay_check != NULL) {
|
||||||
ctx->obscured) {
|
|
||||||
tty_draw_pane(tty, ctx, ctx->ocy);
|
tty_draw_pane(tty, ctx, ctx->ocy);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1750,15 +1748,14 @@ 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) ||
|
||||||
!tty_term_has(tty->term, TTYC_IL1) ||
|
!tty_term_has(tty->term, TTYC_IL1) ||
|
||||||
ctx->sx == 1 ||
|
ctx->sx == 1 ||
|
||||||
ctx->sy == 1 ||
|
ctx->sy == 1 ||
|
||||||
c->overlay_check != NULL ||
|
c->overlay_check != NULL) {
|
||||||
ctx->obscured) {
|
|
||||||
tty_redraw_region(tty, ctx);
|
tty_redraw_region(tty, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1779,15 +1776,14 @@ 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) ||
|
||||||
!tty_term_has(tty->term, TTYC_DL1) ||
|
!tty_term_has(tty->term, TTYC_DL1) ||
|
||||||
ctx->sx == 1 ||
|
ctx->sx == 1 ||
|
||||||
ctx->sy == 1 ||
|
ctx->sy == 1 ||
|
||||||
c->overlay_check != NULL ||
|
c->overlay_check != NULL) {
|
||||||
ctx->obscured) {
|
|
||||||
tty_redraw_region(tty, ctx);
|
tty_redraw_region(tty, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1915,14 +1911,13 @@ 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) ||
|
||||||
ctx->sx == 1 ||
|
ctx->sx == 1 ||
|
||||||
ctx->sy == 1 ||
|
ctx->sy == 1 ||
|
||||||
c->overlay_check != NULL ||
|
c->overlay_check != NULL) {
|
||||||
ctx->obscured) {
|
|
||||||
tty_redraw_region(tty, ctx);
|
tty_redraw_region(tty, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1955,7 +1950,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) ||
|
||||||
@@ -1963,8 +1958,7 @@ tty_cmd_scrolldown(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
!tty_term_has(tty->term, TTYC_RIN)) ||
|
!tty_term_has(tty->term, TTYC_RIN)) ||
|
||||||
ctx->sx == 1 ||
|
ctx->sx == 1 ||
|
||||||
ctx->sy == 1 ||
|
ctx->sy == 1 ||
|
||||||
c->overlay_check != NULL ||
|
c->overlay_check != NULL) {
|
||||||
ctx->obscured) {
|
|
||||||
tty_redraw_region(tty, ctx);
|
tty_redraw_region(tty, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2058,7 +2052,7 @@ tty_cmd_alignmenttest(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
{
|
{
|
||||||
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)) {
|
||||||
ctx->redraw_cb(ctx);
|
ctx->redraw_cb(ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user