mirror of
https://github.com/tmux/tmux.git
synced 2026-10-08 10:54:28 +00:00
Include menus when working out what parts of a pane are visible to avoid
overwriting them, GitHub issue 5593.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: screen-write.c,v 1.297 2026/10/02 14:16:42 nicm Exp $ */
|
||||
/* $OpenBSD: screen-write.c,v 1.298 2026/10/02 15:20:41 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -189,11 +189,12 @@ screen_write_set_client_cb(struct tty_ctx *ttyctx, struct client *c)
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Return 1 if there is a floating window pane overlapping this pane. */
|
||||
/* Return 1 if a menu or floating pane overlaps this pane. */
|
||||
static int
|
||||
screen_write_pane_is_obscured(struct screen_write_ctx *ctx)
|
||||
{
|
||||
struct window_pane *wp = ctx->wp;
|
||||
struct menu_data *md;
|
||||
|
||||
if (ctx->wp == NULL)
|
||||
return (0);
|
||||
@@ -204,6 +205,16 @@ screen_write_pane_is_obscured(struct screen_write_ctx *ctx)
|
||||
}
|
||||
ctx->flags |= SCREEN_WRITE_CHECKED_IF_OBSCURED;
|
||||
|
||||
md = wp->window->menu;
|
||||
if (md != NULL &&
|
||||
(int)menu_x(md) < wp->xoff + (int)wp->sx &&
|
||||
(int)(menu_x(md) + menu_width(md)) > wp->xoff &&
|
||||
(int)menu_y(md) < wp->yoff + (int)wp->sy &&
|
||||
(int)(menu_y(md) + menu_height(md)) > wp->yoff) {
|
||||
ctx->flags |= SCREEN_WRITE_OBSCURED;
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (ctx->wp->xoff < 0 ||
|
||||
ctx->wp->yoff < 0 ||
|
||||
ctx->wp->xoff + ctx->wp->sx > ctx->wp->window->sx ||
|
||||
@@ -2435,13 +2446,18 @@ screen_write_collect_flush_line(struct screen_write_ctx *ctx, u_int y)
|
||||
ttyctx.n = w_length;
|
||||
tty_write(tty_cmd_clearcharacter, &ttyctx);
|
||||
} else {
|
||||
screen_write_initctx(ctx, &ttyctx, 0, 0);
|
||||
ttyctx.cell = &ci->gc;
|
||||
if (ci->wrapped)
|
||||
ttyctx.flags |= TTY_CTX_WRAPPED;
|
||||
ttyctx.data.data = cl->data + w_start;
|
||||
ttyctx.data.size = w_length;
|
||||
tty_write(tty_cmd_cells, &ttyctx);
|
||||
screen_write_initctx(ctx, &ttyctx, 0, 1);
|
||||
if (ttyctx.flags & TTY_CTX_PANE_OBSCURED) {
|
||||
ttyctx.n = w_length;
|
||||
tty_write(tty_cmd_redrawline, &ttyctx);
|
||||
} else {
|
||||
ttyctx.cell = &ci->gc;
|
||||
if (ci->wrapped)
|
||||
ttyctx.flags |= TTY_CTX_WRAPPED;
|
||||
ttyctx.data.data = cl->data + w_start;
|
||||
ttyctx.data.size = w_length;
|
||||
tty_write(tty_cmd_cells, &ttyctx);
|
||||
}
|
||||
}
|
||||
items++;
|
||||
written = 1;
|
||||
@@ -2844,6 +2860,11 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||
/* Create space for character in insert mode. */
|
||||
if (s->mode & MODE_INSERT) {
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
if (wp != NULL && screen_write_pane_is_obscured(ctx)) {
|
||||
if (screen_write_should_draw_line(ctx, s->cy))
|
||||
screen_write_redraw_line(ctx, &ttyctx, s->cy);
|
||||
return;
|
||||
}
|
||||
ttyctx.n = width;
|
||||
if (screen_write_should_draw_line(ctx, s->cy))
|
||||
tty_write(tty_cmd_insertcharacter, &ttyctx);
|
||||
|
||||
Reference in New Issue
Block a user