=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tty.c,v retrieving revision 1.181 retrieving revision 1.182 diff -u -r1.181 -r1.182 --- src/usr.bin/tmux/tty.c 2015/05/06 07:52:06 1.181 +++ src/usr.bin/tmux/tty.c 2015/05/12 22:40:38 1.182 @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.181 2015/05/06 07:52:06 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.182 2015/05/12 22:40:38 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -723,9 +723,23 @@ tty_update_mode(tty, tty->mode, s); } +int +tty_client_ready(struct client *c, struct window_pane *wp) +{ + if (c->session == NULL || c->tty.term == NULL) + return (0); + if (c->flags & CLIENT_SUSPENDED) + return (0); + if (c->tty.flags & TTY_FREEZE) + return (0); + if (c->session->curw->window != wp->window) + return (0); + return (1); +} + void -tty_write( - void (*cmdfn)(struct tty *, const struct tty_ctx *), struct tty_ctx *ctx) +tty_write(void (*cmdfn)(struct tty *, const struct tty_ctx *), + struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; struct client *c; @@ -740,13 +754,7 @@ return; TAILQ_FOREACH(c, &clients, entry) { - if (c->session == NULL || c->tty.term == NULL) - continue; - if (c->flags & CLIENT_SUSPENDED) - continue; - if (c->tty.flags & TTY_FREEZE) - continue; - if (c->session->curw->window != wp->window) + if (!tty_client_ready(c, wp)) continue; ctx->xoff = wp->xoff;