diff --git a/format.c b/format.c index 1f8d518d..d977f154 100644 --- a/format.c +++ b/format.c @@ -1157,15 +1157,13 @@ static void * format_cb_pane_at_top(struct format_tree *ft) { struct window_pane *wp = ft->wp; - struct window *w; int status, flag; char *value; if (wp == NULL) return (NULL); - w = wp->window; - status = window_get_pane_status(w); + status = window_pane_get_pane_status(wp); if (status == PANE_STATUS_TOP) flag = (wp->yoff == 1); else @@ -1187,7 +1185,7 @@ format_cb_pane_at_bottom(struct format_tree *ft) return (NULL); w = wp->window; - status = options_get_number(w->options, "pane-border-status"); + status = window_pane_get_pane_status(wp); if (status == PANE_STATUS_BOTTOM) flag = (wp->yoff + (int)wp->sy == (int)w->sy - 1); else diff --git a/options-table.c b/options-table.c index c2ebf64e..ff33f65f 100644 --- a/options-table.c +++ b/options-table.c @@ -70,7 +70,7 @@ static const char *options_table_pane_scrollbars_position_list[] = { "right", "left", NULL }; static const char *options_table_pane_status_list[] = { - "off", "top", "bottom", NULL + "off", "top", "bottom", "top-floating", "bottom-floating", NULL }; static const char *options_table_pane_border_indicators_list[] = { "off", "colour", "arrows", "both", NULL @@ -1373,7 +1373,7 @@ const struct options_table_entry options_table[] = { { .name = "pane-border-status", .type = OPTIONS_TABLE_CHOICE, - .scope = OPTIONS_TABLE_WINDOW, + .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, .choices = options_table_pane_status_list, .default_num = PANE_STATUS_OFF, .text = "Position of the pane status lines." diff --git a/screen-redraw.c b/screen-redraw.c index ab392c5c..84a3b8b7 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -125,7 +125,8 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp, { struct options *oo = wp->window->options; int ex = wp->xoff + wp->sx, ey = wp->yoff + wp->sy; - int hsplit = 0, vsplit = 0, pane_status = ctx->pane_status; + int hsplit = 0, vsplit = 0; + int pane_status = window_pane_get_pane_status(wp); int pane_scrollbars = ctx->pane_scrollbars, sb_w = 0; int sb_pos, sx = wp->sx, sy = wp->sy; enum layout_type split_type; @@ -296,7 +297,7 @@ screen_redraw_cell_border(struct screen_redraw_ctx *ctx, struct window_pane *wp, } /* Outside the window or on the window border? */ - if (ctx->pane_status == PANE_STATUS_BOTTOM) + if (window_pane_get_pane_status(wp) == PANE_STATUS_BOTTOM) sy--; if (px > sx || py > sy) return (0); @@ -327,7 +328,8 @@ screen_redraw_type_of_cell(struct screen_redraw_ctx *ctx, { struct client *c = ctx->c; struct window *w = c->session->curw->window; - int pane_status = ctx->pane_status, borders = 0; + int pane_status = window_pane_get_pane_status(wp); + int borders = 0; int sx = w->sx, sy = w->sy; /* Is this outside the window? */ @@ -435,7 +437,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py, struct window *w = c->session->curw->window; struct window_pane *wp, *start; int sx = w->sx, sy = w->sy; - int pane_status = ctx->pane_status; + int pane_status; int border, pane_scrollbars = ctx->pane_scrollbars; int pane_status_line, tiled_only = 0, left, right; int sb_pos = ctx->pane_scrollbars_pos, sb_w; @@ -511,6 +513,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py, * Pane border status inside top/bottom border is CELL_INSIDE * so it doesn't get overdrawn by a border line. */ + pane_status = window_pane_get_pane_status(wp); if (pane_status != PANE_STATUS_OFF) { if (pane_status == PANE_STATUS_TOP) pane_status_line = wp->yoff - 1; @@ -593,13 +596,19 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp, struct format_tree *ft; struct style_line_entry *sle = &wp->border_status_line; char *expanded; - int pane_status = rctx->pane_status, sb_w = 0; + int pane_status = window_pane_get_pane_status(wp); + int sb_w = 0; int pane_scrollbars = rctx->pane_scrollbars; int max_width; u_int width, i, cell_type, px, py; struct screen_write_ctx ctx; struct screen old; + if (pane_status == PANE_STATUS_OFF) { + wp->status_size = 0; + return (0); + } + if (window_pane_show_scrollbar(wp, pane_scrollbars)) sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad; @@ -673,7 +682,7 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx) struct visible_ranges *r; struct visible_range *ri; u_int i, l, x, width, size; - int xoff, yoff; + int xoff, yoff, pane_status; log_debug("%s: %s @%u", __func__, c->name, w->id); @@ -683,7 +692,10 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx) s = &wp->status_screen; size = wp->status_size; - if (ctx->pane_status == PANE_STATUS_TOP) + pane_status = window_pane_get_pane_status(wp); + if (pane_status == PANE_STATUS_OFF) + continue; + if (pane_status == PANE_STATUS_TOP) yoff = wp->yoff - 1; else yoff = wp->yoff + wp->sy; @@ -754,16 +766,14 @@ screen_redraw_update(struct screen_redraw_ctx *ctx, uint64_t flags) if (c->overlay_draw != NULL) flags |= CLIENT_REDRAWOVERLAY; - if (ctx->pane_status != PANE_STATUS_OFF) { - lines = ctx->pane_lines; - redraw = 0; - TAILQ_FOREACH(wp, &w->panes, entry) { - if (screen_redraw_make_pane_status(c, wp, ctx, lines)) - redraw = 1; - } - if (redraw) - flags |= CLIENT_REDRAWBORDERS; + lines = ctx->pane_lines; + redraw = 0; + TAILQ_FOREACH(wp, &w->panes, entry) { + if (screen_redraw_make_pane_status(c, wp, ctx, lines)) + redraw = 1; } + if (redraw) + flags |= CLIENT_REDRAWBORDERS; return (flags); } @@ -787,7 +797,6 @@ screen_redraw_set_context(struct client *c, struct screen_redraw_ctx *ctx) ctx->statustop = 1; ctx->statuslines = lines; - ctx->pane_status = window_get_pane_status(w); ctx->pane_lines = options_get_number(w->options, "pane-border-lines"); ctx->pane_scrollbars = options_get_number(w->options, @@ -824,8 +833,7 @@ screen_redraw_screen(struct client *c) if (flags & (CLIENT_REDRAWWINDOW|CLIENT_REDRAWBORDERS)) { log_debug("%s: redrawing borders", c->name); screen_redraw_draw_borders(&ctx); - if (ctx.pane_status != PANE_STATUS_OFF) - screen_redraw_draw_pane_status(&ctx); + screen_redraw_draw_pane_status(&ctx); screen_redraw_draw_pane_scrollbars(&ctx); } if (flags & CLIENT_REDRAWWINDOW) { diff --git a/server-client.c b/server-client.c index 665bcd01..aaecf47e 100644 --- a/server-client.c +++ b/server-client.c @@ -610,7 +610,7 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py, sb = options_get_number(w->options, "pane-scrollbars"); sb_pos = options_get_number(w->options, "pane-scrollbars-position"); - pane_status = window_get_pane_status(w); + pane_status = window_pane_get_pane_status(wp); if (window_pane_show_scrollbar(wp, sb)) { sb_w = wp->scrollbar_style.width; diff --git a/tmux.1 b/tmux.1 index 0f8e0c13..bbb43f19 100644 --- a/tmux.1 +++ b/tmux.1 @@ -5640,9 +5640,14 @@ and will fall back to standard ACS line drawing when UTF\-8 is not supported. .Pp .It Xo Ic pane\-border\-status -.Op Ic off | top | bottom +.Op Ic off | top | bottom | top\-floating | bottom\-floating .Xc Turn pane border status lines off or set their position. +If set to +.Ic top\-floating +or +.Ic bottom\-floating , +status lines are shown only on floating panes. .Pp .It Ic pane\-border\-style Ar style Set the pane border style for panes aside from the active pane. diff --git a/tmux.h b/tmux.h index 87aaf93d..1897494b 100644 --- a/tmux.h +++ b/tmux.h @@ -1112,7 +1112,6 @@ struct screen_redraw_ctx { u_int statuslines; int statustop; - int pane_status; enum pane_lines pane_lines; int pane_scrollbars; @@ -1450,6 +1449,8 @@ TAILQ_HEAD(winlink_stack, winlink); #define PANE_STATUS_OFF 0 #define PANE_STATUS_TOP 1 #define PANE_STATUS_BOTTOM 2 +#define PANE_STATUS_TOP_FLOATING 3 +#define PANE_STATUS_BOTTOM_FLOATING 4 /* Pane scrollbars option. */ #define PANE_SCROLLBARS_OFF 0 @@ -3523,6 +3524,7 @@ int window_get_bg_client(struct window_pane *); enum client_theme window_pane_get_theme(struct window_pane *); void window_pane_send_theme_update(struct window_pane *); int window_get_pane_status(struct window *); +int window_pane_get_pane_status(struct window_pane *); struct style_range *window_pane_status_get_range(struct window_pane *, u_int, u_int); int window_pane_is_floating(struct window_pane *); diff --git a/window.c b/window.c index 09c444d7..8b9098fb 100644 --- a/window.c +++ b/window.c @@ -2137,16 +2137,14 @@ struct style_range * window_pane_status_get_range(struct window_pane *wp, u_int x, u_int y) { struct style_ranges *srs; - struct window *w; u_int line; int pane_status; if (wp == NULL) return (NULL); - w = wp->window; srs = &wp->border_status_line.ranges; - pane_status = window_get_pane_status(w); + pane_status = window_pane_get_pane_status(wp); if (pane_status == PANE_STATUS_TOP) line = wp->yoff - 1; else if (pane_status == PANE_STATUS_BOTTOM) @@ -2164,7 +2162,29 @@ window_pane_status_get_range(struct window_pane *wp, u_int x, u_int y) int window_get_pane_status(struct window *w) { - return (options_get_number(w->options, "pane-border-status")); + int status; + + status = options_get_number(w->options, "pane-border-status"); + if (status == PANE_STATUS_TOP_FLOATING || + status == PANE_STATUS_BOTTOM_FLOATING) + return (PANE_STATUS_OFF); + return (status); +} + +int +window_pane_get_pane_status(struct window_pane *wp) +{ + int status; + + if (!window_pane_is_floating(wp)) + return (window_get_pane_status(wp->window)); + + status = options_get_number(wp->options, "pane-border-status"); + if (status == PANE_STATUS_TOP_FLOATING) + return (PANE_STATUS_TOP); + if (status == PANE_STATUS_BOTTOM_FLOATING) + return (PANE_STATUS_BOTTOM); + return (status); } int