diff options
Diffstat (limited to 'format.c')
-rw-r--r-- | format.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -929,6 +929,9 @@ format_cb_pane_fg(struct format_tree *ft) 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 @@ format_cb_pane_bg(struct format_tree *ft) 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))); } @@ -3079,6 +3085,22 @@ format_free(struct format_tree *ft) 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, (void *)prefix); +} + /* Walk each format. */ void format_each(struct format_tree *ft, void (*cb)(const char *, const char *, |