=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server-client.c,v retrieving revision 1.325 retrieving revision 1.326 diff -c -r1.325 -r1.326 *** src/usr.bin/tmux/server-client.c 2020/04/18 07:32:53 1.325 --- src/usr.bin/tmux/server-client.c 2020/04/18 21:35:32 1.326 *************** *** 1,4 **** ! /* $OpenBSD: server-client.c,v 1.325 2020/04/18 07:32:53 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: server-client.c,v 1.326 2020/04/18 21:35:32 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 1370,1375 **** --- 1370,1376 ---- if (resize) server_client_check_resize(wp); } + wp->flags &= ~PANE_REDRAW; } check_window_name(w); } *************** *** 1679,1686 **** --- 1680,1690 ---- { struct session *s = c->session; struct tty *tty = &c->tty; + struct window *w = c->session->curw->window; struct window_pane *wp; int needed, flags, mode = tty->mode, new_flags = 0; + int redraw; + u_int bit = 0; struct timeval tv = { .tv_usec = 1000 }; static struct event ev; size_t left; *************** *** 1705,1711 **** if (c->flags & CLIENT_ALLREDRAWFLAGS) needed = 1; else { ! TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) { if (wp->flags & PANE_REDRAW) { needed = 1; break; --- 1709,1715 ---- if (c->flags & CLIENT_ALLREDRAWFLAGS) needed = 1; else { ! TAILQ_FOREACH(wp, &w->panes, entry) { if (wp->flags & PANE_REDRAW) { needed = 1; break; *************** *** 1722,1746 **** log_debug("redraw timer started"); evtimer_add(&ev, &tv); } c->flags |= new_flags; return; } else if (needed) log_debug("%s: redraw needed", c->name); flags = tty->flags & (TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR); ! tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE)) | TTY_NOCURSOR; if (~c->flags & CLIENT_REDRAWWINDOW) { /* * If not redrawing the entire window, check whether each pane * needs to be redrawn. */ ! TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) { ! if (wp->flags & PANE_REDRAW) { ! log_debug("%s: redrawing pane %%%u", __func__, wp->id); ! tty_update_mode(tty, mode, NULL); ! screen_redraw_pane(c, wp); ! } } c->flags &= ~CLIENT_REDRAWPANES; } --- 1726,1771 ---- log_debug("redraw timer started"); evtimer_add(&ev, &tv); } + if (new_flags & CLIENT_REDRAWPANES) { + c->redraw_panes = 0; + TAILQ_FOREACH(wp, &w->panes, entry) { + if (wp->flags & PANE_REDRAW) + c->redraw_panes |= (1 << bit); + if (++bit == 64) { + /* + * If more that 64 panes, give up and + * just redraw the window. + */ + new_flags &= CLIENT_REDRAWPANES; + new_flags |= CLIENT_REDRAWWINDOW; + break; + } + } + } c->flags |= new_flags; return; } else if (needed) log_debug("%s: redraw needed", c->name); flags = tty->flags & (TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR); ! tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE))|TTY_NOCURSOR; if (~c->flags & CLIENT_REDRAWWINDOW) { /* * If not redrawing the entire window, check whether each pane * needs to be redrawn. */ ! TAILQ_FOREACH(wp, &w->panes, entry) { ! redraw = 0; ! if (wp->flags & PANE_REDRAW) ! redraw = 1; ! else if (c->flags & CLIENT_REDRAWPANES) ! redraw = !!(c->redraw_panes & (1 << bit)); ! if (!redraw) ! continue; ! log_debug("%s: redrawing pane %%%u", __func__, wp->id); ! tty_update_mode(tty, mode, NULL); ! screen_redraw_pane(c, wp); } c->flags &= ~CLIENT_REDRAWPANES; } *************** *** 1752,1760 **** screen_redraw_screen(c); } ! tty->flags = (tty->flags & ~TTY_NOCURSOR) | (flags & TTY_NOCURSOR); tty_update_mode(tty, mode, NULL); ! tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR)) | flags; c->flags &= ~(CLIENT_ALLREDRAWFLAGS|CLIENT_STATUSFORCE); --- 1777,1785 ---- screen_redraw_screen(c); } ! tty->flags = (tty->flags & ~TTY_NOCURSOR)|(flags & TTY_NOCURSOR); tty_update_mode(tty, mode, NULL); ! tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR))|flags; c->flags &= ~(CLIENT_ALLREDRAWFLAGS|CLIENT_STATUSFORCE);