diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-06-30 22:36:12 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-06-30 22:36:12 +0000 |
commit | 871fdcc34e420ade89356318fec24ce24b4e6f53 (patch) | |
tree | 137fc15c9c3afa2b3eaa2c4824d0c56cd873c752 /usr.bin/tmux | |
parent | b3c357f5f064c1b79099ec9e6c913172b01e0537 (diff) |
Fix previous when we end up able to show no panes.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/window-tree.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/tmux/window-tree.c b/usr.bin/tmux/window-tree.c index b94147db04f..960e59db768 100644 --- a/usr.bin/tmux/window-tree.c +++ b/usr.bin/tmux/window-tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-tree.c,v 1.6 2017/06/30 22:24:08 nicm Exp $ */ +/* $OpenBSD: window-tree.c,v 1.7 2017/06/30 22:36:11 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -432,6 +432,8 @@ window_tree_draw_session(struct session *s, struct screen_write_ctx *ctx, each = sx / n; if (each < 24) { n = (sx - 6) / 24; + if (n == 0) + n = 1; each = (sx - 6) / n; left = sx - (n * each); @@ -440,7 +442,7 @@ window_tree_draw_session(struct session *s, struct screen_write_ctx *ctx, screen_write_cursormove(ctx, sx - left + left / 2, sy / 2); screen_write_puts(ctx, &grid_default_cell, "..."); - if (sx == left) + if (each == 0) return; left = 0; } else @@ -466,7 +468,8 @@ window_tree_draw_session(struct session *s, struct screen_write_ctx *ctx, xasprintf(&label, " %u ", wl->idx); len = strlen(label) / 2; screen_write_cursormove(ctx, i * each + each / 2 - len, sy / 2); - screen_write_puts(ctx, &gc, "%s", label); + if (len <= width) + screen_write_puts(ctx, &gc, "%s", label); free(label); if (i != n - 1) { @@ -500,6 +503,8 @@ window_tree_draw_window(struct session *s, struct window *w, each = sx / n; if (each < 24) { n = (sx - 6) / 24; + if (n == 0) + n = 1; each = (sx - 6) / n; left = sx - (n * each); @@ -508,7 +513,7 @@ window_tree_draw_window(struct session *s, struct window *w, screen_write_cursormove(ctx, sx - left + left / 2, sy / 2); screen_write_puts(ctx, &grid_default_cell, "..."); - if (sx == left) + if (each == 0) return; left = 0; } else @@ -531,7 +536,8 @@ window_tree_draw_window(struct session *s, struct window *w, xasprintf(&label, " %u ", i); len = strlen(label) / 2; screen_write_cursormove(ctx, i * each + each / 2 - len, sy / 2); - screen_write_puts(ctx, &gc, "%s", label); + if (len <= width) + screen_write_puts(ctx, &gc, "%s", label); free(label); if (i != n - 1) { |