summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/cmd-set-option.c4
-rw-r--r--usr.bin/tmux/resize.c4
-rw-r--r--usr.bin/tmux/session.c4
-rw-r--r--usr.bin/tmux/status.c21
-rw-r--r--usr.bin/tmux/tmux.h6
5 files changed, 28 insertions, 11 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index 1aaef633851..ef2ff43f97f 100644
--- a/usr.bin/tmux/cmd-set-option.c
+++ b/usr.bin/tmux/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-option.c,v 1.110 2017/01/25 23:50:51 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.111 2017/02/03 21:01:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -248,6 +248,8 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
RB_FOREACH(w, windows, &windows)
layout_fix_panes(w, w->sx, w->sy);
}
+ RB_FOREACH (s, sessions, &sessions)
+ status_update_saved(s);
/*
* Update sizes and redraw. May not always be necessary but do it
diff --git a/usr.bin/tmux/resize.c b/usr.bin/tmux/resize.c
index 11c261e786e..55d846e107e 100644
--- a/usr.bin/tmux/resize.c
+++ b/usr.bin/tmux/resize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resize.c,v 1.20 2016/10/16 22:06:40 nicm Exp $ */
+/* $OpenBSD: resize.c,v 1.21 2017/02/03 21:01:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -89,6 +89,8 @@ recalculate_sizes(void)
s->sx = ssx;
s->sy = ssy;
+
+ status_update_saved(s);
}
RB_FOREACH(w, windows, &windows) {
diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c
index d4aec35927a..044e0fdb633 100644
--- a/usr.bin/tmux/session.c
+++ b/usr.bin/tmux/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.70 2016/10/19 09:22:07 nicm Exp $ */
+/* $OpenBSD: session.c,v 1.71 2017/02/03 21:01:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -131,6 +131,8 @@ session_create(const char *name, int argc, char **argv, const char *path,
s->options = options_create(global_s_options);
s->hooks = hooks_create(global_hooks);
+ status_update_saved(s);
+
s->tio = NULL;
if (tio != NULL) {
s->tio = xmalloc(sizeof *s->tio);
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index 7a587717cf0..1630d1b3930 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.160 2017/02/03 11:57:27 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.161 2017/02/03 21:01:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -192,17 +192,26 @@ status_timer_start_all(void)
status_timer_start(c);
}
+/* Update status cache. */
+void
+status_update_saved(struct session *s)
+{
+ if (!options_get_number(s->options, "status"))
+ s->statusat = -1;
+ else if (options_get_number(s->options, "status-position") == 0)
+ s->statusat = 0;
+ else
+ s->statusat = 1;
+}
+
/* Get screen line of status line. -1 means off. */
int
status_at_line(struct client *c)
{
struct session *s = c->session;
- if (!options_get_number(s->options, "status"))
- return (-1);
-
- if (options_get_number(s->options, "status-position") == 0)
- return (0);
+ if (s->statusat != 1)
+ return (s->statusat);
return (c->tty.sy - 1);
}
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index fe6c5b08879..1a42cd6d318 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.711 2017/02/03 11:57:27 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.712 2017/02/03 21:01:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -545,7 +545,6 @@ struct grid_cell {
int fg;
int bg;
struct utf8_data data;
-
};
struct grid_cell_entry {
u_char flags;
@@ -936,6 +935,8 @@ struct session {
struct winlink_stack lastw;
struct winlinks windows;
+ int statusat;
+
struct hooks *hooks;
struct options *options;
@@ -1864,6 +1865,7 @@ void server_unzoom_window(struct window *);
/* status.c */
void status_timer_start(struct client *);
void status_timer_start_all(void);
+void status_update_saved(struct session *s);
int status_at_line(struct client *);
struct window *status_get_window_at(struct client *, u_int);
int status_redraw(struct client *);