mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Add -F to refresh-client to specify flags for control clients - one flag
at the moment, no-output which turns off forwarding pane output. From Thomas Adam. GitHub issue 1834.
This commit is contained in:
		@@ -19,6 +19,7 @@
 | 
				
			|||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "tmux.h"
 | 
					#include "tmux.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -33,8 +34,9 @@ const struct cmd_entry cmd_refresh_client_entry = {
 | 
				
			|||||||
	.name = "refresh-client",
 | 
						.name = "refresh-client",
 | 
				
			||||||
	.alias = "refresh",
 | 
						.alias = "refresh",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.args = { "cC:DlLRSt:U", 0, 1 },
 | 
						.args = { "cC:DF:lLRSt:U", 0, 1 },
 | 
				
			||||||
	.usage = "[-cDlLRSU] [-C size] " CMD_TARGET_CLIENT_USAGE " [adjustment]",
 | 
						.usage = "[-cDlLRSU] [-C XxY] [-F flags] " CMD_TARGET_CLIENT_USAGE
 | 
				
			||||||
 | 
							" [adjustment]",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.flags = CMD_AFTERHOOK,
 | 
						.flags = CMD_AFTERHOOK,
 | 
				
			||||||
	.exec = cmd_refresh_client_exec
 | 
						.exec = cmd_refresh_client_exec
 | 
				
			||||||
@@ -48,6 +50,7 @@ cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
	struct tty	*tty;
 | 
						struct tty	*tty;
 | 
				
			||||||
	struct window	*w;
 | 
						struct window	*w;
 | 
				
			||||||
	const char	*size, *errstr;
 | 
						const char	*size, *errstr;
 | 
				
			||||||
 | 
						char		*copy, *next, *s;
 | 
				
			||||||
	u_int		 x, y, adjust;
 | 
						u_int		 x, y, adjust;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
 | 
						if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
 | 
				
			||||||
@@ -107,13 +110,18 @@ cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
	if (args_has(args, 'l')) {
 | 
						if (args_has(args, 'l')) {
 | 
				
			||||||
		if (c->session != NULL)
 | 
							if (c->session != NULL)
 | 
				
			||||||
			tty_putcode_ptr2(&c->tty, TTYC_MS, "", "?");
 | 
								tty_putcode_ptr2(&c->tty, TTYC_MS, "", "?");
 | 
				
			||||||
	} else if (args_has(args, 'C')) {
 | 
							return (CMD_RETURN_NORMAL);
 | 
				
			||||||
		if ((size = args_get(args, 'C')) == NULL) {
 | 
						}
 | 
				
			||||||
			cmdq_error(item, "missing size");
 | 
					
 | 
				
			||||||
 | 
						if (args_has(args, 'C') || args_has(args, 'F')) {
 | 
				
			||||||
 | 
							if (args_has(args, 'C')) {
 | 
				
			||||||
 | 
								if (!(c->flags & CLIENT_CONTROL)) {
 | 
				
			||||||
 | 
									cmdq_error(item, "not a control client");
 | 
				
			||||||
				return (CMD_RETURN_ERROR);
 | 
									return (CMD_RETURN_ERROR);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								size = args_get(args, 'C');
 | 
				
			||||||
			if (sscanf(size, "%u,%u", &x, &y) != 2 &&
 | 
								if (sscanf(size, "%u,%u", &x, &y) != 2 &&
 | 
				
			||||||
		    sscanf(size, "%ux%u", &x, &y)) {
 | 
								    sscanf(size, "%ux%u", &x, &y) != 2) {
 | 
				
			||||||
				cmdq_error(item, "bad size argument");
 | 
									cmdq_error(item, "bad size argument");
 | 
				
			||||||
				return (CMD_RETURN_ERROR);
 | 
									return (CMD_RETURN_ERROR);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -122,13 +130,23 @@ cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
				cmdq_error(item, "size too small or too big");
 | 
									cmdq_error(item, "size too small or too big");
 | 
				
			||||||
				return (CMD_RETURN_ERROR);
 | 
									return (CMD_RETURN_ERROR);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								tty_set_size(&c->tty, x, y);
 | 
				
			||||||
 | 
								c->flags |= CLIENT_SIZECHANGED;
 | 
				
			||||||
 | 
								recalculate_sizes();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (args_has(args, 'F')) {
 | 
				
			||||||
			if (!(c->flags & CLIENT_CONTROL)) {
 | 
								if (!(c->flags & CLIENT_CONTROL)) {
 | 
				
			||||||
				cmdq_error(item, "not a control client");
 | 
									cmdq_error(item, "not a control client");
 | 
				
			||||||
				return (CMD_RETURN_ERROR);
 | 
									return (CMD_RETURN_ERROR);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		tty_set_size(&c->tty, x, y);
 | 
								s = copy = xstrdup(args_get(args, 'F'));
 | 
				
			||||||
		c->flags |= CLIENT_SIZECHANGED;
 | 
								while ((next = strsep(&s, ",")) != NULL) {
 | 
				
			||||||
		recalculate_sizes();
 | 
									/* Unknown flags are ignored. */
 | 
				
			||||||
 | 
									if (strcmp(next, "no-output") == 0)
 | 
				
			||||||
 | 
										c->flags |= CLIENT_CONTROL_NOOUTPUT;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								free(copy);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		return (CMD_RETURN_NORMAL);
 | 
							return (CMD_RETURN_NORMAL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,6 +36,9 @@ control_notify_input(struct client *c, struct window_pane *wp,
 | 
				
			|||||||
	if (c->session == NULL)
 | 
						if (c->session == NULL)
 | 
				
			||||||
	    return;
 | 
						    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (c->flags & CLIENT_CONTROL_NOOUTPUT)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Only write input if the window pane is linked to a window belonging
 | 
						 * Only write input if the window pane is linked to a window belonging
 | 
				
			||||||
	 * to the client's session.
 | 
						 * to the client's session.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								tmux.1
									
									
									
									
									
								
							@@ -1162,7 +1162,8 @@ is used, the
 | 
				
			|||||||
option will not be applied.
 | 
					option will not be applied.
 | 
				
			||||||
.It Xo Ic refresh-client
 | 
					.It Xo Ic refresh-client
 | 
				
			||||||
.Op Fl cDlLRSU
 | 
					.Op Fl cDlLRSU
 | 
				
			||||||
.Op Fl C Ar width,height
 | 
					.Op Fl C Ar XxY
 | 
				
			||||||
 | 
					.Op Fl F Ar flags
 | 
				
			||||||
.Op Fl t Ar target-client
 | 
					.Op Fl t Ar target-client
 | 
				
			||||||
.Op Ar adjustment
 | 
					.Op Ar adjustment
 | 
				
			||||||
.Xc
 | 
					.Xc
 | 
				
			||||||
@@ -1205,7 +1206,13 @@ window, changing the current window in the attached session will reset
 | 
				
			|||||||
it.
 | 
					it.
 | 
				
			||||||
.Pp
 | 
					.Pp
 | 
				
			||||||
.Fl C
 | 
					.Fl C
 | 
				
			||||||
sets the width and height of a control client.
 | 
					sets the width and height of a control client and
 | 
				
			||||||
 | 
					.Fl F
 | 
				
			||||||
 | 
					sets a comma-separated list of flags.
 | 
				
			||||||
 | 
					Currently the only flag available is
 | 
				
			||||||
 | 
					.Ql no-output
 | 
				
			||||||
 | 
					to disable receiving pane output.
 | 
				
			||||||
 | 
					.Pp
 | 
				
			||||||
.Fl l
 | 
					.Fl l
 | 
				
			||||||
requests the clipboard from the client using the
 | 
					requests the clipboard from the client using the
 | 
				
			||||||
.Xr xterm 1
 | 
					.Xr xterm 1
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1516,6 +1516,7 @@ struct client {
 | 
				
			|||||||
#define CLIENT_STATUSOFF 0x800000
 | 
					#define CLIENT_STATUSOFF 0x800000
 | 
				
			||||||
#define CLIENT_REDRAWSTATUSALWAYS 0x1000000
 | 
					#define CLIENT_REDRAWSTATUSALWAYS 0x1000000
 | 
				
			||||||
#define CLIENT_REDRAWOVERLAY 0x2000000
 | 
					#define CLIENT_REDRAWOVERLAY 0x2000000
 | 
				
			||||||
 | 
					#define CLIENT_CONTROL_NOOUTPUT 0x4000000
 | 
				
			||||||
#define CLIENT_ALLREDRAWFLAGS		\
 | 
					#define CLIENT_ALLREDRAWFLAGS		\
 | 
				
			||||||
	(CLIENT_REDRAWWINDOW|		\
 | 
						(CLIENT_REDRAWWINDOW|		\
 | 
				
			||||||
	 CLIENT_REDRAWSTATUS|		\
 | 
						 CLIENT_REDRAWSTATUS|		\
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user