mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	For passthrough, don't write to clients attached to different sessions,
based on a fix from Sergei Grechanik.
This commit is contained in:
		@@ -132,6 +132,12 @@ screen_write_set_client_cb(struct tty_ctx *ttyctx, struct client *c)
 | 
			
		||||
{
 | 
			
		||||
	struct window_pane	*wp = ttyctx->arg;
 | 
			
		||||
 | 
			
		||||
	if (ttyctx->allow_invisible_panes) {
 | 
			
		||||
		if (session_has(c->session, wp->window))
 | 
			
		||||
			return (1);
 | 
			
		||||
		return (0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (c->session->curw->window != wp->window)
 | 
			
		||||
		return (0);
 | 
			
		||||
	if (wp->layout_cell == NULL)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										27
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								tty.c
									
									
									
									
									
								
							@@ -34,8 +34,6 @@
 | 
			
		||||
 | 
			
		||||
static int	tty_log_fd = -1;
 | 
			
		||||
 | 
			
		||||
static int	tty_client_ready(struct client *);
 | 
			
		||||
 | 
			
		||||
static void	tty_set_italics(struct tty *);
 | 
			
		||||
static int	tty_try_colour(struct tty *, int, const char *);
 | 
			
		||||
static void	tty_force_cursor_colour(struct tty *, int);
 | 
			
		||||
@@ -1607,11 +1605,21 @@ tty_sync_end(struct tty *tty)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
tty_client_ready(struct client *c)
 | 
			
		||||
tty_client_ready(const struct tty_ctx *ctx, struct client *c)
 | 
			
		||||
{
 | 
			
		||||
	if (c->session == NULL || c->tty.term == NULL)
 | 
			
		||||
		return (0);
 | 
			
		||||
	if (c->flags & (CLIENT_REDRAWWINDOW|CLIENT_SUSPENDED))
 | 
			
		||||
	if (c->flags & CLIENT_SUSPENDED)
 | 
			
		||||
		return (0);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * If invisible panes are allowed (used for passthrough), don't care if
 | 
			
		||||
	 * redrawing or frozen.
 | 
			
		||||
	 */
 | 
			
		||||
	if (ctx->allow_invisible_panes)
 | 
			
		||||
		return (1);
 | 
			
		||||
 | 
			
		||||
	if (c->flags & CLIENT_REDRAWWINDOW)
 | 
			
		||||
		return (0);
 | 
			
		||||
	if (c->tty.flags & TTY_FREEZE)
 | 
			
		||||
		return (0);
 | 
			
		||||
@@ -1628,23 +1636,16 @@ tty_write(void (*cmdfn)(struct tty *, const struct tty_ctx *),
 | 
			
		||||
	if (ctx->set_client_cb == NULL)
 | 
			
		||||
		return;
 | 
			
		||||
	TAILQ_FOREACH(c, &clients, entry) {
 | 
			
		||||
		if (ctx->allow_invisible_panes) {
 | 
			
		||||
		    if (c->session == NULL ||
 | 
			
		||||
			c->tty.term == NULL ||
 | 
			
		||||
			c->flags & CLIENT_SUSPENDED)
 | 
			
		||||
			    continue;
 | 
			
		||||
		} else {
 | 
			
		||||
			if (!tty_client_ready(c))
 | 
			
		||||
				continue;
 | 
			
		||||
		if (tty_client_ready(ctx, c)) {
 | 
			
		||||
			state = ctx->set_client_cb(ctx, c);
 | 
			
		||||
			if (state == -1)
 | 
			
		||||
				break;
 | 
			
		||||
			if (state == 0)
 | 
			
		||||
				continue;
 | 
			
		||||
		}
 | 
			
		||||
			cmdfn(&c->tty, ctx);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user