From c332b98de754601cadd1ed486b04ed3dd6e52d69 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 4 Jul 2017 12:26:14 +0000 Subject: [PATCH] Handle 0 size of preview box in caller. --- usr.bin/tmux/mode-tree.c | 7 ++++--- usr.bin/tmux/window-tree.c | 6 +----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/usr.bin/tmux/mode-tree.c b/usr.bin/tmux/mode-tree.c index 85077c6f18a..88c9a8664ea 100644 --- a/usr.bin/tmux/mode-tree.c +++ b/usr.bin/tmux/mode-tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mode-tree.c,v 1.6 2017/06/09 16:01:39 nicm Exp $ */ +/* $OpenBSD: mode-tree.c,v 1.7 2017/07/04 12:26:14 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott @@ -445,7 +445,7 @@ void mode_tree_draw(struct mode_tree_data *mtd) { struct window_pane *wp = mtd->wp; - struct screen *s = &mtd->screen, *box; + struct screen *s = &mtd->screen, *box = NULL; struct mode_tree_line *line; struct mode_tree_item *mti; struct options *oo = wp->window->options; @@ -571,7 +571,8 @@ mode_tree_draw(struct mode_tree_data *mtd) box_x = w - 4; box_y = sy - h - 2; - box = mtd->drawcb(mtd->modedata, mti->itemdata, box_x, box_y); + if (box_x != 0 && box_y != 0) + box = mtd->drawcb(mtd->modedata, mti->itemdata, box_x, box_y); if (box != NULL) { screen_write_cursormove(&ctx, 2, h + 1); screen_write_copy(&ctx, box, 0, 0, box_x, box_y, NULL, NULL); diff --git a/usr.bin/tmux/window-tree.c b/usr.bin/tmux/window-tree.c index 3c4958014df..07f3545707e 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.9 2017/07/03 22:48:02 nicm Exp $ */ +/* $OpenBSD: window-tree.c,v 1.10 2017/07/04 12:26:14 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott @@ -422,8 +422,6 @@ window_tree_draw_session(struct session *s, struct screen_write_ctx *ctx, char *label; size_t len; - if (sx == 0) - return; total = winlink_count(&s->windows); memcpy(&gc, &grid_default_cell, sizeof gc); @@ -544,8 +542,6 @@ window_tree_draw_window(struct session *s, struct window *w, char *label; size_t len; - if (sx == 0) - return; total = window_count_panes(w); memcpy(&gc, &grid_default_cell, sizeof gc); -- 2.20.1