diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-06-11 09:55:48 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-06-11 09:55:48 +0000 |
commit | 5cac799121f5895596fe597420633edb59d403d2 (patch) | |
tree | e922224a39aad007f8a657038656f58f703c2a40 | |
parent | 0529ec376803903373863e5ba657eb3c18425ac0 (diff) |
Add a -A option to pause a pane manually.
-rw-r--r-- | usr.bin/tmux/cmd-refresh-client.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/control.c | 16 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 15 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 |
4 files changed, 30 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-refresh-client.c b/usr.bin/tmux/cmd-refresh-client.c index 35163d64cf4..aee99980f08 100644 --- a/usr.bin/tmux/cmd-refresh-client.c +++ b/usr.bin/tmux/cmd-refresh-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-refresh-client.c,v 1.37 2020/06/05 07:33:57 nicm Exp $ */ +/* $OpenBSD: cmd-refresh-client.c,v 1.38 2020/06/11 09:55:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -68,6 +68,8 @@ cmd_refresh_client_update_offset(struct client *tc, const char *value) control_set_pane_off(tc, wp); else if (strcmp(colon, "continue") == 0) control_continue_pane(tc, wp); + else if (strcmp(colon, "pause") == 0) + control_pause_pane(tc, wp); out: free(copy); diff --git a/usr.bin/tmux/control.c b/usr.bin/tmux/control.c index c944858b293..151ae909086 100644 --- a/usr.bin/tmux/control.c +++ b/usr.bin/tmux/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.40 2020/06/10 07:27:10 nicm Exp $ */ +/* $OpenBSD: control.c,v 1.41 2020/06/11 09:55:47 nicm Exp $ */ /* * Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -265,6 +265,20 @@ control_continue_pane(struct client *c, struct window_pane *wp) } } +/* Pause a pane. */ +void +control_pause_pane(struct client *c, struct window_pane *wp) +{ + struct control_pane *cp; + + cp = control_add_pane(c, wp); + if (~cp->flags & CONTROL_PANE_PAUSED) { + cp->flags |= CONTROL_PANE_PAUSED; + control_discard_pane(c, cp); + control_write(c, "%%pause %%%u", wp->id); + } +} + /* Write a line. */ static void control_vwrite(struct client *c, const char *fmt, va_list ap) diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 2bf63fe7cb1..5b692193a39 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.780 2020/06/10 07:27:10 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.781 2020/06/11 09:55:47 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 10 2020 $ +.Dd $Mdocdate: June 11 2020 $ .Dt TMUX 1 .Os .Sh NAME @@ -1304,9 +1304,10 @@ The argument is a pane ID (with leading .Ql % ) , a colon, then one of .Ql on , -.Ql off +.Ql off , +.Ql continue or -.Ql continue . +.Ql pause . If .Ql off , .Nm @@ -1315,9 +1316,13 @@ the pane off, will stop reading from the pane. If .Ql continue , .Nm -will return to sending output to a paused pane (see the +will return to sending output to the pane if it was paused (manually or with the .Ar pause-after flag). +If +.Ql pause , +.Nm +will pause the pane. .Fl A may be given multiple times for different panes. .Pp diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 60866213b6d..8a9a2d8ee8c 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1066 2020/06/10 07:27:10 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1067 2020/06/11 09:55:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -2846,6 +2846,7 @@ void control_stop(struct client *); void control_set_pane_on(struct client *, struct window_pane *); void control_set_pane_off(struct client *, struct window_pane *); void control_continue_pane(struct client *, struct window_pane *); +void control_pause_pane(struct client *, struct window_pane *); struct window_pane_offset *control_pane_offset(struct client *, struct window_pane *, int *); void control_reset_offsets(struct client *); |