mirror of
https://github.com/tmux/tmux.git
synced 2026-05-30 14:16:18 +00:00
Tidy up a load of different flags and special values in the tty_ctx into
a single bitmask.
This commit is contained in:
67
tty.c
67
tty.c
@@ -1104,7 +1104,7 @@ tty_is_visible(__unused struct tty *tty, const struct tty_ctx *ctx, u_int px,
|
||||
{
|
||||
u_int xoff = ctx->rxoff + px, yoff = ctx->ryoff + py;
|
||||
|
||||
if (!ctx->bigger)
|
||||
if (~ctx->flags & TTY_CTX_WINDOW_BIGGER)
|
||||
return (1);
|
||||
|
||||
if (xoff + nx <= ctx->wox || xoff >= ctx->wox + ctx->wsx ||
|
||||
@@ -1372,9 +1372,9 @@ tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py)
|
||||
struct visible_ranges *r;
|
||||
struct visible_range *rr;
|
||||
|
||||
log_debug("%s: %s %u %d", __func__, tty->client->name, py, ctx->bigger);
|
||||
log_debug("%s: %s %u", __func__, tty->client->name, py);
|
||||
|
||||
if (!ctx->bigger) {
|
||||
if (~ctx->flags & TTY_CTX_WINDOW_BIGGER) {
|
||||
r = tty_check_overlay_range(tty, ctx->xoff, ctx->yoff + py, nx);
|
||||
for (j = 0; j < r->used; j++) {
|
||||
rr = &r->ranges[j];
|
||||
@@ -1504,7 +1504,7 @@ tty_client_ready(const struct tty_ctx *ctx, struct client *c)
|
||||
* If invisible panes are allowed (used for passthrough), don't care if
|
||||
* redrawing or frozen.
|
||||
*/
|
||||
if (ctx->allow_invisible_panes)
|
||||
if (ctx->flags & TTY_CTX_INVISIBLE_PANES)
|
||||
return (1);
|
||||
|
||||
if (c->flags & CLIENT_REDRAWWINDOW)
|
||||
@@ -1540,7 +1540,7 @@ tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
|
||||
if (ctx->bigger ||
|
||||
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) ||
|
||||
!tty_full_width(tty, ctx) ||
|
||||
tty_fake_bce(tty, &ctx->defaults, ctx->bg) ||
|
||||
(!tty_term_has(tty->term, TTYC_ICH) &&
|
||||
@@ -1563,7 +1563,7 @@ tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
|
||||
if (ctx->bigger ||
|
||||
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) ||
|
||||
!tty_full_width(tty, ctx) ||
|
||||
tty_fake_bce(tty, &ctx->defaults, ctx->bg) ||
|
||||
(!tty_term_has(tty->term, TTYC_DCH) &&
|
||||
@@ -1595,7 +1595,7 @@ tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
|
||||
if (ctx->bigger ||
|
||||
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) ||
|
||||
!tty_full_width(tty, ctx) ||
|
||||
tty_fake_bce(tty, &ctx->defaults, ctx->bg) ||
|
||||
!tty_term_has(tty->term, TTYC_CSR) ||
|
||||
@@ -1623,7 +1623,7 @@ tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
|
||||
if (ctx->bigger ||
|
||||
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) ||
|
||||
!tty_full_width(tty, ctx) ||
|
||||
tty_fake_bce(tty, &ctx->defaults, ctx->bg) ||
|
||||
!tty_term_has(tty->term, TTYC_CSR) ||
|
||||
@@ -1683,7 +1683,7 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
|
||||
if (ctx->ocy != ctx->orupper)
|
||||
return;
|
||||
|
||||
if (ctx->bigger ||
|
||||
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) ||
|
||||
(!tty_full_width(tty, ctx) && !tty_use_margin(tty)) ||
|
||||
tty_fake_bce(tty, &ctx->defaults, 8) ||
|
||||
!tty_term_has(tty->term, TTYC_CSR) ||
|
||||
@@ -1717,7 +1717,7 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
|
||||
if (ctx->ocy != ctx->orlower)
|
||||
return;
|
||||
|
||||
if (ctx->bigger ||
|
||||
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) ||
|
||||
(!tty_full_width(tty, ctx) && !tty_use_margin(tty)) ||
|
||||
tty_fake_bce(tty, &ctx->defaults, 8) ||
|
||||
!tty_term_has(tty->term, TTYC_CSR) ||
|
||||
@@ -1758,7 +1758,7 @@ tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx)
|
||||
struct client *c = tty->client;
|
||||
u_int i;
|
||||
|
||||
if (ctx->bigger ||
|
||||
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) ||
|
||||
(!tty_full_width(tty, ctx) && !tty_use_margin(tty)) ||
|
||||
tty_fake_bce(tty, &ctx->defaults, 8) ||
|
||||
!tty_term_has(tty->term, TTYC_CSR) ||
|
||||
@@ -1797,7 +1797,7 @@ tty_cmd_scrolldown(struct tty *tty, const struct tty_ctx *ctx)
|
||||
u_int i;
|
||||
struct client *c = tty->client;
|
||||
|
||||
if (ctx->bigger ||
|
||||
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) ||
|
||||
(!tty_full_width(tty, ctx) && !tty_use_margin(tty)) ||
|
||||
tty_fake_bce(tty, &ctx->defaults, 8) ||
|
||||
!tty_term_has(tty->term, TTYC_CSR) ||
|
||||
@@ -1899,7 +1899,7 @@ tty_cmd_alignmenttest(struct tty *tty, const struct tty_ctx *ctx)
|
||||
{
|
||||
u_int i, j;
|
||||
|
||||
if (ctx->bigger) {
|
||||
if (ctx->flags & TTY_CTX_WINDOW_BIGGER) {
|
||||
ctx->redraw_cb(ctx);
|
||||
return;
|
||||
}
|
||||
@@ -1931,7 +1931,7 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
|
||||
(gcp->data.width == 1 && !tty_check_overlay(tty, px, py)))
|
||||
return;
|
||||
|
||||
if (ctx->num == 2) {
|
||||
if (ctx->flags & TTY_CTX_CELL_DRAW_LINE) {
|
||||
tty_draw_line(tty, s, 0, s->cy, screen_size_x(s),
|
||||
ctx->xoff - ctx->wox, py, &ctx->defaults, ctx->palette);
|
||||
return;
|
||||
@@ -1960,7 +1960,7 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
|
||||
tty_cell(tty, ctx->cell, &ctx->defaults, ctx->palette,
|
||||
ctx->s->hyperlinks);
|
||||
|
||||
if (ctx->num == 1)
|
||||
if (ctx->flags & TTY_CTX_CELL_INVALIDATE)
|
||||
tty_invalidate(tty);
|
||||
}
|
||||
|
||||
@@ -1975,10 +1975,10 @@ tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx)
|
||||
if (!tty_is_visible(tty, ctx, ctx->ocx, ctx->ocy, ctx->num, 1))
|
||||
return;
|
||||
|
||||
if (ctx->bigger &&
|
||||
if ((ctx->flags & TTY_CTX_WINDOW_BIGGER) &&
|
||||
(ctx->xoff + ctx->ocx < ctx->wox ||
|
||||
ctx->xoff + ctx->ocx + ctx->num > ctx->wox + ctx->wsx)) {
|
||||
if (!ctx->wrapped ||
|
||||
if ((~ctx->flags & TTY_CTX_WRAPPED) ||
|
||||
!tty_full_width(tty, ctx) ||
|
||||
(tty->term->flags & TERM_NOAM) ||
|
||||
ctx->xoff + ctx->ocx != 0 ||
|
||||
@@ -2050,20 +2050,23 @@ tty_cmd_rawstring(struct tty *tty, const struct tty_ctx *ctx)
|
||||
void
|
||||
tty_cmd_syncstart(struct tty *tty, const struct tty_ctx *ctx)
|
||||
{
|
||||
if (ctx->num == 0x11) {
|
||||
/*
|
||||
* This is an overlay and a command that moves the cursor so
|
||||
* start synchronized updates.
|
||||
*/
|
||||
tty_sync_start(tty);
|
||||
} else if (~ctx->num & 0x10) {
|
||||
/*
|
||||
* This is a pane. If there is an overlay, always start;
|
||||
* otherwise, only if requested.
|
||||
*/
|
||||
if (ctx->num || tty->client->overlay_draw != NULL)
|
||||
tty_sync_start(tty);
|
||||
}
|
||||
struct client *c = tty->client;
|
||||
|
||||
if ((ctx->flags & TTY_CTX_OVERLAY_SYNC) &&
|
||||
(ctx->flags & TTY_CTX_SYNC)) {
|
||||
/*
|
||||
* This is an overlay and a command that moves the cursor so
|
||||
* start synchronized updates.
|
||||
*/
|
||||
tty_sync_start(tty);
|
||||
} else if (~ctx->flags & TTY_CTX_OVERLAY_SYNC) {
|
||||
/*
|
||||
* This is a pane. If there is an overlay, always start;
|
||||
* otherwise, only if requested.
|
||||
*/
|
||||
if ((ctx->flags & TTY_CTX_SYNC) || c->overlay_draw != NULL)
|
||||
tty_sync_start(tty);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2229,7 +2232,7 @@ static void
|
||||
tty_cursor_pane_unless_wrap(struct tty *tty, const struct tty_ctx *ctx,
|
||||
u_int cx, u_int cy)
|
||||
{
|
||||
if (!ctx->wrapped ||
|
||||
if ((~ctx->flags & TTY_CTX_WRAPPED) ||
|
||||
!tty_full_width(tty, ctx) ||
|
||||
(tty->term->flags & TERM_NOAM) ||
|
||||
ctx->xoff + cx != 0 ||
|
||||
|
||||
Reference in New Issue
Block a user