aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-02-03 22:01:18 +0000
committerThomas Adam <thomas@xteddy.org>2017-02-03 22:01:18 +0000
commite1c283325ecf6496f2107efc5c8d32257017558c (patch)
treef7bf71b1bd97b81f82c611aae5567310a9d28327
parent6c333cc4864c11283704b069fa6477876fd48f70 (diff)
parent5e6a8177e55a8e30e0cd67c7ee3039aa22ff1c0e (diff)
downloadrtmux-e1c283325ecf6496f2107efc5c8d32257017558c.tar.gz
rtmux-e1c283325ecf6496f2107efc5c8d32257017558c.tar.bz2
rtmux-e1c283325ecf6496f2107efc5c8d32257017558c.zip
Merge branch 'obsd-master'
-rw-r--r--cmd-set-option.c2
-rw-r--r--grid.c6
-rw-r--r--resize.c2
-rw-r--r--session.c2
-rw-r--r--status.c19
-rw-r--r--tmux.h4
6 files changed, 29 insertions, 6 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c
index c7cef42c..cc8b7570 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -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/grid.c b/grid.c
index dbb4fe64..f1dc130b 100644
--- a/grid.c
+++ b/grid.c
@@ -292,6 +292,12 @@ grid_expand_line(struct grid *gd, u_int py, u_int sx, u_int bg)
if (sx <= gl->cellsize)
return;
+ if (sx < gd->sx) {
+ sx *= 2;
+ if (sx > gd->sx)
+ sx = gd->sx;
+ }
+
gl->celldata = xreallocarray(gl->celldata, sx, sizeof *gl->celldata);
for (xx = gl->cellsize; xx < sx; xx++)
grid_clear_cell(gd, xx, py, bg);
diff --git a/resize.c b/resize.c
index 2d3f02cc..ba8078bc 100644
--- a/resize.c
+++ b/resize.c
@@ -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/session.c b/session.c
index d89bc6a0..e2ff65b1 100644
--- a/session.c
+++ b/session.c
@@ -130,6 +130,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/status.c b/status.c
index c4f79050..6cc1ee37 100644
--- a/status.c
+++ b/status.c
@@ -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/tmux.h b/tmux.h
index 69f99d63..9dee7a1a 100644
--- a/tmux.h
+++ b/tmux.h
@@ -547,7 +547,6 @@ struct grid_cell {
int fg;
int bg;
struct utf8_data data;
-
};
struct grid_cell_entry {
u_char flags;
@@ -938,6 +937,8 @@ struct session {
struct winlink_stack lastw;
struct winlinks windows;
+ int statusat;
+
struct hooks *hooks;
struct options *options;
@@ -1866,6 +1867,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 *);