diff options
author | 2020-06-10 06:23:43 +0000 | |
---|---|---|
committer | 2020-06-10 06:23:43 +0000 | |
commit | 26066ee443181461f433a0a369d34b6daa3a7efb (patch) | |
tree | 69b896f6e54377bf3d6de8909c3655dae6d1089d | |
parent | regen (diff) | |
download | wireguard-openbsd-26066ee443181461f433a0a369d34b6daa3a7efb.tar.xz wireguard-openbsd-26066ee443181461f433a0a369d34b6daa3a7efb.zip |
When the pause-after flag is set, send an alternative %extended-output
form instead of %output with the age of the output.
-rw-r--r-- | usr.bin/tmux/control.c | 25 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 15 |
2 files changed, 31 insertions, 9 deletions
diff --git a/usr.bin/tmux/control.c b/usr.bin/tmux/control.c index 56d0f0e7641..c404f4b4c67 100644 --- a/usr.bin/tmux/control.c +++ b/usr.bin/tmux/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.38 2020/06/05 07:33:57 nicm Exp $ */ +/* $OpenBSD: control.c,v 1.39 2020/06/10 06:23:43 nicm Exp $ */ /* * Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -462,8 +462,8 @@ control_flush_all_blocks(struct client *c) /* Append data to buffer. */ static struct evbuffer * -control_append_data(struct control_pane *cp, struct evbuffer *message, - struct window_pane *wp, size_t size) +control_append_data(struct client *c, struct control_pane *cp, uint64_t age, + struct evbuffer *message, struct window_pane *wp, size_t size) { u_char *new_data; size_t new_size; @@ -473,7 +473,12 @@ control_append_data(struct control_pane *cp, struct evbuffer *message, message = evbuffer_new(); if (message == NULL) fatalx("out of memory"); - evbuffer_add_printf(message, "%%output %%%u ", wp->id); + if (c->flags & CLIENT_CONTROL_PAUSEAFTER) { + evbuffer_add_printf(message, + "%%extended-output %%%u %llu : ", wp->id, + (unsigned long long)age); + } else + evbuffer_add_printf(message, "%%output %%%u ", wp->id); } new_data = window_pane_get_new_data(wp, &cp->offset, &new_size); @@ -512,6 +517,7 @@ control_write_pending(struct client *c, struct control_pane *cp, size_t limit) struct evbuffer *message = NULL; size_t used = 0, size; struct control_block *cb, *cb1; + uint64_t age, t = get_timer(); wp = control_window_pane(c, cp->pane); if (wp == NULL) { @@ -525,15 +531,20 @@ control_write_pending(struct client *c, struct control_pane *cp, size_t limit) while (used != limit && !TAILQ_EMPTY(&cp->blocks)) { cb = TAILQ_FIRST(&cp->blocks); - log_debug("%s: %s: output block %zu for %%%u (used %zu/%zu)", - __func__, c->name, cb->size, cp->pane, used, limit); + if (cb->t < t) + age = t - cb->t; + else + age = 0; + log_debug("%s: %s: output block %zu (age %llu) for %%%u " + "(used %zu/%zu)", __func__, c->name, cb->size, age, + cp->pane, used, limit); size = cb->size; if (size > limit - used) size = limit - used; used += size; - message = control_append_data(cp, message, wp, size); + message = control_append_data(c, cp, age, message, wp, size); cb->size -= size; if (cb->size == 0) { diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 226f4498f70..4e2105c2b62 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.778 2020/06/05 07:33:57 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.779 2020/06/10 06:23:43 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: June 5 2020 $ +.Dd $Mdocdate: June 10 2020 $ .Dt TMUX 1 .Os .Sh NAME @@ -5910,6 +5910,17 @@ or an error occurred. If present, .Ar reason describes why the client exited. +.It Ic %extended-output Ar pane-id Ar age Ar ... : Ar value +New form of +.Ic %output +sent when the +.Ar pause-after +flag is set. +.Ar age +is the time in milliseconds for which tmux had buffered the output before it was sent. +Any subsequent arguments up until a single +.Ql \&: +are for future use and should be ignored. .It Ic %layout-change Ar window-id Ar window-layout Ar window-visible-layout Ar window-flags The layout of a window with ID .Ar window-id |