=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/format.c,v retrieving revision 1.288 retrieving revision 1.289 diff -u -r1.288 -r1.289 --- src/usr.bin/tmux/format.c 2021/07/13 22:09:29 1.288 +++ src/usr.bin/tmux/format.c 2021/08/12 08:05:11 1.289 @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.288 2021/07/13 22:09:29 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.289 2021/08/12 08:05:11 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -929,6 +929,9 @@ struct window_pane *wp = ft->wp; struct grid_cell gc; + if (wp == NULL) + return (NULL); + tty_default_colours(&gc, wp); return (xstrdup(colour_tostring(gc.fg))); } @@ -940,6 +943,9 @@ struct window_pane *wp = ft->wp; struct grid_cell gc; + if (wp == NULL) + return (NULL); + tty_default_colours(&gc, wp); return (xstrdup(colour_tostring(gc.bg))); } @@ -3077,6 +3083,22 @@ if (ft->client != NULL) server_client_unref(ft->client); free(ft); +} + +/* Log each format. */ +static void +format_log_debug_cb(const char *key, const char *value, void *arg) +{ + const char *prefix = arg; + + log_debug("%s: %s=%s", prefix, key, value); +} + +/* Log a format tree. */ +void +format_log_debug(struct format_tree *ft, const char *prefix) +{ + format_each(ft, format_log_debug_cb, prefix); } /* Walk each format. */