Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2020-04-18 10:01:31 +01:00
commit e1799ed7c8
7 changed files with 37 additions and 13 deletions

View File

@ -2690,6 +2690,9 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
format_add(ft, "history_limit", "%u", gd->hlimit); format_add(ft, "history_limit", "%u", gd->hlimit);
format_add_cb(ft, "history_bytes", format_cb_history_bytes); format_add_cb(ft, "history_bytes", format_cb_history_bytes);
format_add(ft, "pane_written", "%zu", wp->written);
format_add(ft, "pane_skipped", "%zu", wp->skipped);
if (window_pane_index(wp, &idx) != 0) if (window_pane_index(wp, &idx) != 0)
fatalx("index not found"); fatalx("index not found");
format_add(ft, "pane_index", "%u", idx); format_add(ft, "pane_index", "%u", idx);

View File

@ -474,6 +474,7 @@ screen_redraw_pane(struct client *c, struct window_pane *wp)
tty_sync_start(&c->tty); tty_sync_start(&c->tty);
screen_redraw_draw_pane(&ctx, wp); screen_redraw_draw_pane(&ctx, wp);
wp->flags &= ~PANE_REDRAW;
tty_reset(&c->tty); tty_reset(&c->tty);
tty_sync_end(&c->tty); tty_sync_end(&c->tty);
@ -563,6 +564,7 @@ screen_redraw_draw_panes(struct screen_redraw_ctx *ctx)
TAILQ_FOREACH(wp, &w->panes, entry) { TAILQ_FOREACH(wp, &w->panes, entry) {
if (window_pane_visible(wp)) if (window_pane_visible(wp))
screen_redraw_draw_pane(ctx, wp); screen_redraw_draw_pane(ctx, wp);
wp->flags &= ~PANE_REDRAW;
} }
} }

View File

@ -174,6 +174,10 @@ screen_write_stop(struct screen_write_ctx *ctx)
log_debug("%s: %u cells (%u written, %u skipped)", __func__, log_debug("%s: %u cells (%u written, %u skipped)", __func__,
ctx->cells, ctx->written, ctx->skipped); ctx->cells, ctx->written, ctx->skipped);
if (ctx->wp != NULL) {
ctx->wp->written += ctx->written;
ctx->wp->skipped += ctx->skipped;
}
if (ctx->sync) { if (ctx->sync) {
screen_write_initctx(ctx, &ttyctx, 0); screen_write_initctx(ctx, &ttyctx, 0);

View File

@ -1368,7 +1368,6 @@ server_client_loop(void)
if (resize) if (resize)
server_client_check_resize(wp); server_client_check_resize(wp);
} }
wp->flags &= ~PANE_REDRAW;
} }
check_window_name(w); check_window_name(w);
} }
@ -1679,7 +1678,7 @@ server_client_check_redraw(struct client *c)
struct session *s = c->session; struct session *s = c->session;
struct tty *tty = &c->tty; struct tty *tty = &c->tty;
struct window_pane *wp; struct window_pane *wp;
int needed, flags, mode = tty->mode; int needed, flags, mode = tty->mode, new_flags = 0;
struct timeval tv = { .tv_usec = 1000 }; struct timeval tv = { .tv_usec = 1000 };
static struct event ev; static struct event ev;
size_t left; size_t left;
@ -1687,11 +1686,12 @@ server_client_check_redraw(struct client *c)
if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED)) if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
return; return;
if (c->flags & CLIENT_ALLREDRAWFLAGS) { if (c->flags & CLIENT_ALLREDRAWFLAGS) {
log_debug("%s: redraw%s%s%s%s", c->name, log_debug("%s: redraw%s%s%s%s%s", c->name,
(c->flags & CLIENT_REDRAWWINDOW) ? " window" : "", (c->flags & CLIENT_REDRAWWINDOW) ? " window" : "",
(c->flags & CLIENT_REDRAWSTATUS) ? " status" : "", (c->flags & CLIENT_REDRAWSTATUS) ? " status" : "",
(c->flags & CLIENT_REDRAWBORDERS) ? " borders" : "", (c->flags & CLIENT_REDRAWBORDERS) ? " borders" : "",
(c->flags & CLIENT_REDRAWOVERLAY) ? " overlay" : ""); (c->flags & CLIENT_REDRAWOVERLAY) ? " overlay" : "",
(c->flags & CLIENT_REDRAWPANES) ? " panes" : "");
} }
/* /*
@ -1709,6 +1709,8 @@ server_client_check_redraw(struct client *c)
break; break;
} }
} }
if (needed)
new_flags |= CLIENT_REDRAWPANES;
} }
if (needed && (left = EVBUFFER_LENGTH(tty->out)) != 0) { if (needed && (left = EVBUFFER_LENGTH(tty->out)) != 0) {
log_debug("%s: redraw deferred (%zu left)", c->name, left); log_debug("%s: redraw deferred (%zu left)", c->name, left);
@ -1718,19 +1720,13 @@ server_client_check_redraw(struct client *c)
log_debug("redraw timer started"); log_debug("redraw timer started");
evtimer_add(&ev, &tv); evtimer_add(&ev, &tv);
} }
c->flags |= new_flags;
/*
* We may have got here for a single pane redraw, but force a
* full redraw next time in case other panes have been updated.
*/
c->flags |= CLIENT_ALLREDRAWFLAGS;
return; return;
} else if (needed) } else if (needed)
log_debug("%s: redraw needed", c->name); log_debug("%s: redraw needed", c->name);
flags = tty->flags & (TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR); flags = tty->flags & (TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR);
tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE)) | TTY_NOCURSOR; tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE)) | TTY_NOCURSOR;
tty_update_mode(tty, mode, NULL);
if (~c->flags & CLIENT_REDRAWWINDOW) { if (~c->flags & CLIENT_REDRAWWINDOW) {
/* /*
@ -1740,13 +1736,15 @@ server_client_check_redraw(struct client *c)
TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) { TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) {
if (wp->flags & PANE_REDRAW) { if (wp->flags & PANE_REDRAW) {
log_debug("%s: redrawing pane %%%u", __func__, wp->id); log_debug("%s: redrawing pane %%%u", __func__, wp->id);
tty_update_mode(tty, tty->mode, NULL); tty_update_mode(tty, mode, NULL);
screen_redraw_pane(c, wp); screen_redraw_pane(c, wp);
} }
} }
c->flags &= ~CLIENT_REDRAWPANES;
} }
if (c->flags & CLIENT_ALLREDRAWFLAGS) { if (c->flags & CLIENT_ALLREDRAWFLAGS) {
tty_update_mode(tty, mode, NULL);
if (options_get_number(s->options, "set-titles")) if (options_get_number(s->options, "set-titles"))
server_client_set_title(c); server_client_set_title(c);
screen_redraw_screen(c); screen_redraw_screen(c);

2
tmux.1
View File

@ -4450,6 +4450,7 @@ The following variables are available, where appropriate:
.It Li "pane_pipe" Ta "" Ta "1 if pane is being piped" .It Li "pane_pipe" Ta "" Ta "1 if pane is being piped"
.It Li "pane_right" Ta "" Ta "Right of pane" .It Li "pane_right" Ta "" Ta "Right of pane"
.It Li "pane_search_string" Ta "" Ta "Last search string in copy mode" .It Li "pane_search_string" Ta "" Ta "Last search string in copy mode"
.It Li "pane_skipped" Ta "" Ta "Bytes skipped as not visible in pane"
.It Li "pane_start_command" Ta "" Ta "Command pane started with" .It Li "pane_start_command" Ta "" Ta "Command pane started with"
.It Li "pane_synchronized" Ta "" Ta "1 if pane is synchronized" .It Li "pane_synchronized" Ta "" Ta "1 if pane is synchronized"
.It Li "pane_tabs" Ta "" Ta "Pane tab positions" .It Li "pane_tabs" Ta "" Ta "Pane tab positions"
@ -4457,6 +4458,7 @@ The following variables are available, where appropriate:
.It Li "pane_top" Ta "" Ta "Top of pane" .It Li "pane_top" Ta "" Ta "Top of pane"
.It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane" .It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
.It Li "pane_width" Ta "" Ta "Width of pane" .It Li "pane_width" Ta "" Ta "Width of pane"
.It Li "pane_written" Ta "" Ta "Bytes written by pane (aside from redrawing)"
.It Li "pid" Ta "" Ta "Server PID" .It Li "pid" Ta "" Ta "Server PID"
.It Li "popup_key" Ta "" Ta "Key pressed in popup" .It Li "popup_key" Ta "" Ta "Key pressed in popup"
.It Li "popup_mouse_x" Ta "" Ta "Mouse X position in popup" .It Li "popup_mouse_x" Ta "" Ta "Mouse X position in popup"

7
tmux.h
View File

@ -936,6 +936,9 @@ struct window_pane {
char *searchstr; char *searchstr;
int searchregex; int searchregex;
u_int written;
u_int skipped;
TAILQ_ENTRY(window_pane) entry; TAILQ_ENTRY(window_pane) entry;
RB_ENTRY(window_pane) tree_entry; RB_ENTRY(window_pane) tree_entry;
}; };
@ -1541,12 +1544,14 @@ struct client {
#define CLIENT_CONTROL_NOOUTPUT 0x4000000 #define CLIENT_CONTROL_NOOUTPUT 0x4000000
#define CLIENT_DEFAULTSOCKET 0x8000000 #define CLIENT_DEFAULTSOCKET 0x8000000
#define CLIENT_STARTSERVER 0x10000000 #define CLIENT_STARTSERVER 0x10000000
#define CLIENT_REDRAWPANES 0x20000000
#define CLIENT_ALLREDRAWFLAGS \ #define CLIENT_ALLREDRAWFLAGS \
(CLIENT_REDRAWWINDOW| \ (CLIENT_REDRAWWINDOW| \
CLIENT_REDRAWSTATUS| \ CLIENT_REDRAWSTATUS| \
CLIENT_REDRAWSTATUSALWAYS| \ CLIENT_REDRAWSTATUSALWAYS| \
CLIENT_REDRAWBORDERS| \ CLIENT_REDRAWBORDERS| \
CLIENT_REDRAWOVERLAY) CLIENT_REDRAWOVERLAY| \
CLIENT_REDRAWPANES)
#define CLIENT_UNATTACHEDFLAGS \ #define CLIENT_UNATTACHEDFLAGS \
(CLIENT_DEAD| \ (CLIENT_DEAD| \
CLIENT_SUSPENDED| \ CLIENT_SUSPENDED| \

10
tty.c
View File

@ -944,6 +944,7 @@ tty_fake_bce(const struct tty *tty, struct window_pane *wp, u_int bg)
static void static void
tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx) tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct client *c = tty->client;
struct window_pane *wp = ctx->wp; struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen; struct screen *s = wp->screen;
u_int i; u_int i;
@ -953,6 +954,7 @@ tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx)
* likely to be followed by some more scrolling. * likely to be followed by some more scrolling.
*/ */
if (tty_large_region(tty, ctx)) { if (tty_large_region(tty, ctx)) {
log_debug("%s: %s, large redraw of %%%u", __func__, c->name, wp->id);
wp->flags |= PANE_REDRAW; wp->flags |= PANE_REDRAW;
return; return;
} }
@ -1484,6 +1486,14 @@ tty_write(void (*cmdfn)(struct tty *, const struct tty_ctx *),
TAILQ_FOREACH(c, &clients, entry) { TAILQ_FOREACH(c, &clients, entry) {
if (!tty_client_ready(c, wp)) if (!tty_client_ready(c, wp))
continue; continue;
if (c->flags & CLIENT_REDRAWPANES) {
/*
* Redraw is already deferred to redraw another pane -
* redraw this one also when that happens.
*/
wp->flags |= PANE_REDRAW;
break;
}
ctx->bigger = tty_window_offset(&c->tty, &ctx->ox, &ctx->oy, ctx->bigger = tty_window_offset(&c->tty, &ctx->ox, &ctx->oy,
&ctx->sx, &ctx->sy); &ctx->sx, &ctx->sy);