summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/server-client.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-12-03 07:12:11 +0000
committernicm <nicm@openbsd.org>2020-12-03 07:12:11 +0000
commit734f37e42ce702aadc8acf9a44bf763f9d45c021 (patch)
tree2461f924d86af4607673d1d1ae86bf1f062ab3f9 /usr.bin/tmux/server-client.c
parentThere are special rules regarding the memory passed to pthread_attr_setstack(). (diff)
downloadwireguard-openbsd-734f37e42ce702aadc8acf9a44bf763f9d45c021.tar.xz
wireguard-openbsd-734f37e42ce702aadc8acf9a44bf763f9d45c021.zip
Redraw any visible modes when status line changes so that formats like
the pane title are updated. GitHub issue 2487. Also a man page fix from jmc.
Diffstat (limited to 'usr.bin/tmux/server-client.c')
-rw-r--r--usr.bin/tmux/server-client.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index e94f9c5f341..f31efe89ff8 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.365 2020/10/30 18:54:23 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.366 2020/12/03 07:12:11 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -42,6 +42,7 @@ static void server_client_repeat_timer(int, short, void *);
static void server_client_click_timer(int, short, void *);
static void server_client_check_exit(struct client *);
static void server_client_check_redraw(struct client *);
+static void server_client_check_modes(struct client *);
static void server_client_set_title(struct client *);
static void server_client_reset_state(struct client *);
static int server_client_assume_paste(struct session *);
@@ -1355,6 +1356,7 @@ server_client_loop(void)
TAILQ_FOREACH(c, &clients, entry) {
server_client_check_exit(c);
if (c->session != NULL) {
+ server_client_check_modes(c);
server_client_check_redraw(c);
server_client_reset_state(c);
}
@@ -1810,6 +1812,28 @@ server_client_redraw_timer(__unused int fd, __unused short events,
log_debug("redraw timer fired");
}
+/*
+ * Check if modes need to be updated. Only modes in the current window are
+ * updated and it is done when the status line is redrawn.
+ */
+static void
+server_client_check_modes(struct client *c)
+{
+ struct window *w = c->session->curw->window;
+ struct window_pane *wp;
+ struct window_mode_entry *wme;
+
+ if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
+ return;
+ if (~c->flags & CLIENT_REDRAWSTATUS)
+ return;
+ TAILQ_FOREACH(wp, &w->panes, entry) {
+ wme = TAILQ_FIRST(&wp->modes);
+ if (wme != NULL && wme->mode->update != NULL)
+ wme->mode->update(wme);
+ }
+}
+
/* Check for client redraws. */
static void
server_client_check_redraw(struct client *c)