From 5263766303d7eb0d1fb32cb1138b09e68d75ef62 Mon Sep 17 00:00:00 2001 From: Michael Grant <mgrant@grant.org> Date: Sat, 22 Mar 2025 01:19:51 -0200 Subject: [PATCH] Nic's patch, back out my mod to format.c, but still remove the return --- format.c | 10 ++-------- window-tree.c | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/format.c b/format.c index 7853a2ba..9ce56104 100644 --- a/format.c +++ b/format.c @@ -5104,17 +5104,11 @@ format_create_defaults(struct cmdq_item *item, struct client *c, struct session *s, struct winlink *wl, struct window_pane *wp) { struct format_tree *ft; - int tag; - - if (wp == NULL) - tag = FORMAT_NONE; - else - tag = FORMAT_PANE|wp->id; if (item != NULL) - ft = format_create(cmdq_get_client(item), item, tag, 0); + ft = format_create(cmdq_get_client(item), item, FORMAT_NONE, 0); else - ft = format_create(NULL, item, tag, 0); + ft = format_create(NULL, item, FORMAT_NONE, 0); format_defaults(ft, c, s, wl, wp); return (ft); } diff --git a/window-tree.c b/window-tree.c index 5c09ac8a..45dd2485 100644 --- a/window-tree.c +++ b/window-tree.c @@ -302,6 +302,7 @@ window_tree_build_pane(struct session *s, struct winlink *wl, struct window_tree_itemdata *item; char *name, *text; u_int idx; + struct format_tree *ft; window_pane_index(wp, &idx); @@ -311,8 +312,11 @@ window_tree_build_pane(struct session *s, struct winlink *wl, item->winlink = wl->idx; item->pane = wp->id; - text = format_single(NULL, data->format, NULL, s, wl, wp); + ft = format_create(NULL, NULL, FORMAT_PANE|wp->id, 0); + format_defaults(ft, NULL, s, wl, wp); + text = format_expand(ft, data->format); xasprintf(&name, "%u", idx); + format_free(ft); mode_tree_add(data->data, parent, item, (uint64_t)wp, name, text, -1); free(text); @@ -348,6 +352,7 @@ window_tree_build_window(struct session *s, struct winlink *wl, struct window_pane *wp, **l; u_int n, i; int expanded; + struct format_tree *ft; item = window_tree_add_item(data); item->type = WINDOW_TREE_WINDOW; @@ -355,8 +360,11 @@ window_tree_build_window(struct session *s, struct winlink *wl, item->winlink = wl->idx; item->pane = -1; - text = format_single(NULL, data->format, NULL, s, wl, NULL); + ft = format_create(NULL, NULL, FORMAT_PANE|wl->window->active->id, 0); + format_defaults(ft, NULL, s, wl, NULL); + text = format_expand(ft, data->format); xasprintf(&name, "%u", wl->idx); + format_free(ft); if (data->type == WINDOW_TREE_SESSION || data->type == WINDOW_TREE_WINDOW) @@ -410,9 +418,10 @@ window_tree_build_session(struct session *s, void *modedata, struct window_tree_itemdata *item; struct mode_tree_item *mti; char *text; - struct winlink *wl, **l; + struct winlink *wl = s->curw, **l; u_int n, i, empty; int expanded; + struct format_tree *ft; item = window_tree_add_item(data); item->type = WINDOW_TREE_SESSION; @@ -420,7 +429,10 @@ window_tree_build_session(struct session *s, void *modedata, item->winlink = -1; item->pane = -1; - text = format_single(NULL, data->format, NULL, s, NULL, NULL); + ft = format_create(NULL, NULL, FORMAT_PANE|wl->window->active->id, 0); + format_defaults(ft, NULL, s, NULL, NULL); + text = format_expand(ft, data->format); + format_free(ft); if (data->type == WINDOW_TREE_SESSION) expanded = 0;