From b4e74f4310d90affd4e1a4a7328082ac4beb5461 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 25 Sep 2018 09:54:47 +0100 Subject: [PATCH] Add a B flag to mark windows bigger than the client. --- cmd-select-pane.c | 7 ++++--- tmux.1 | 1 + tmux.h | 4 ++-- tty.c | 3 +-- window.c | 4 +++- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/cmd-select-pane.c b/cmd-select-pane.c index 5cec82f2..34b0a3c3 100644 --- a/cmd-select-pane.c +++ b/cmd-select-pane.c @@ -58,6 +58,7 @@ static void cmd_select_pane_redraw(struct window *w) { struct client *c; + struct window *loop; /* * Redraw entire window if it is bigger than the client (the @@ -67,15 +68,15 @@ cmd_select_pane_redraw(struct window *w) TAILQ_FOREACH(c, &clients, entry) { if (c->session == NULL) continue; - if (c->session->curw->window == w && tty_window_bigger(&c->tty)) + loop = c->session->curw->window; + if (loop == w && tty_window_bigger(&c->tty, w)) server_redraw_client(c); else { - if (c->session->curw->window == w) + if (loop == w) c->flags |= CLIENT_REDRAWBORDERS; if (session_has(c->session, w)) c->flags |= CLIENT_REDRAWSTATUS; } - } } diff --git a/tmux.1 b/tmux.1 index a85ff7a5..15904010 100644 --- a/tmux.1 +++ b/tmux.1 @@ -4095,6 +4095,7 @@ The flag is one of the following symbols appended to the window name: .It Li "#" Ta "Window activity is monitored and activity has been detected." .It Li "\&!" Ta "Window bells are monitored and a bell has occurred in the window." .It Li "~" Ta "The window has been silent for the monitor-silence interval." +.It Li "+" Ta "The window is larger than is visible." .It Li "M" Ta "The window contains the marked pane." .It Li "Z" Ta "The window's active pane is zoomed." .El diff --git a/tmux.h b/tmux.h index 7378927a..4ae6d6ad 100644 --- a/tmux.h +++ b/tmux.h @@ -1669,7 +1669,7 @@ struct environ *environ_for_session(struct session *, int); /* tty.c */ void tty_create_log(void); -int tty_window_bigger(struct tty *); +int tty_window_bigger(struct tty *, struct window *); int tty_window_offset(struct tty *, u_int *, u_int *, u_int *, u_int *); void tty_update_window_offset(struct window *); void tty_update_client_offset(struct client *); @@ -2184,7 +2184,7 @@ void window_pane_key(struct window_pane *, struct client *, struct session *, key_code, struct mouse_event *); int window_pane_visible(struct window_pane *); u_int window_pane_search(struct window_pane *, const char *); -const char *window_printable_flags(struct winlink *); +const char *window_printable_flags(struct winlink *, struct client *); struct window_pane *window_pane_find_up(struct window_pane *); struct window_pane *window_pane_find_down(struct window_pane *); struct window_pane *window_pane_find_left(struct window_pane *); diff --git a/tty.c b/tty.c index bf4c1424..f3cbbf23 100644 --- a/tty.c +++ b/tty.c @@ -701,11 +701,10 @@ tty_repeat_space(struct tty *tty, u_int n) /* Is this window bigger than the terminal? */ int -tty_window_bigger(struct tty *tty) +tty_window_bigger(struct tty *tty, struct window *w) { struct client *c = tty->client; struct session *s = c->session; - struct window *w = s->curw->window; return (tty->sx < w->sx || tty->sy - status_line_size(c) < w->sy); } diff --git a/window.c b/window.c index 7d3b0748..3704a633 100644 --- a/window.c +++ b/window.c @@ -739,7 +739,7 @@ window_destroy_panes(struct window *w) } const char * -window_printable_flags(struct winlink *wl) +window_printable_flags(struct winlink *wl, struct client *c) { struct session *s = wl->session; static char flags[32]; @@ -760,6 +760,8 @@ window_printable_flags(struct winlink *wl) flags[pos++] = 'M'; if (wl->window->flags & WINDOW_ZOOMED) flags[pos++] = 'Z'; + if (c != NULL && tty_window_bigger(&c->tty, wl->window)) + flags[pos++] = 'B'; flags[pos] = '\0'; return (flags); }