From: Thomas Adam <tho...@xteddy.org> Currently, a conditional format only returns the string given based on whether the condition is true or false. This means the following does not work:
#{?session_attached,#{session_name},no session} This change expands the item returned from the conditional if it's a recognised format. --- format.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/format.c b/format.c index 7de819a..535256d 100644 --- a/format.c +++ b/format.c @@ -150,7 +150,7 @@ int format_replace(struct format_tree *ft, const char *key, size_t keylen, char **buf, size_t *len, size_t *off) { - char *copy, *ptr; + char *copy, *ptr, *value_found; const char *value; size_t valuelen; @@ -182,6 +182,9 @@ format_replace(struct format_tree *ft, goto fail; value = ptr + 1; } + + if ((value_found = format_expand(ft, value)) != NULL) + value = value_found; } else { value = format_find(ft, copy); if (value == NULL) @@ -232,7 +235,7 @@ format_expand(struct format_tree *ft, const char *fmt) ch = (u_char) *fmt++; switch (ch) { case '{': - ptr = strchr(fmt, '}'); + ptr = strrchr(fmt, '}'); if (ptr == NULL) break; n = ptr - fmt; -- 1.7.10.4 ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users