mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Add a -r flag to switch-client to toggle the client read-only flag. From
Johan Commelin.
This commit is contained in:
		@@ -32,9 +32,9 @@ int	cmd_switch_client_exec(struct cmd *, struct cmd_ctx *);
 | 
			
		||||
 | 
			
		||||
const struct cmd_entry cmd_switch_client_entry = {
 | 
			
		||||
	"switch-client", "switchc",
 | 
			
		||||
	"lc:npt:", 0, 0,
 | 
			
		||||
	"[-lnp] [-c target-client] [-t target-session]",
 | 
			
		||||
	0,
 | 
			
		||||
	"lc:npt:r", 0, 0,
 | 
			
		||||
	"[-lnpr] [-c target-client] [-t target-session]",
 | 
			
		||||
	CMD_READONLY,
 | 
			
		||||
	cmd_switch_client_key_binding,
 | 
			
		||||
	NULL,
 | 
			
		||||
	cmd_switch_client_exec
 | 
			
		||||
@@ -67,6 +67,16 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
			
		||||
	if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL)
 | 
			
		||||
		return (-1);
 | 
			
		||||
 | 
			
		||||
	if (args_has(args, 'r')) {
 | 
			
		||||
		if (c->flags & CLIENT_READONLY) {
 | 
			
		||||
			c->flags &= ~CLIENT_READONLY;
 | 
			
		||||
			ctx->info(ctx, "made client writable");
 | 
			
		||||
		} else {
 | 
			
		||||
			c->flags |= CLIENT_READONLY;
 | 
			
		||||
			ctx->info(ctx, "made client read-only");
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	s = NULL;
 | 
			
		||||
	if (args_has(args, 'n')) {
 | 
			
		||||
		if ((s = session_next_session(c->session)) == NULL) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user