=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window-tree.c,v retrieving revision 1.14 retrieving revision 1.15 diff -c -r1.14 -r1.15 *** src/usr.bin/tmux/window-tree.c 2017/07/28 10:59:58 1.14 --- src/usr.bin/tmux/window-tree.c 2017/08/09 11:43:45 1.15 *************** *** 1,4 **** ! /* $OpenBSD: window-tree.c,v 1.14 2017/07/28 10:59:58 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: window-tree.c,v 1.15 2017/08/09 11:43:45 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott *************** *** 33,38 **** --- 33,54 ---- #define WINDOW_TREE_DEFAULT_COMMAND "switch-client -t '%%'" + #define WINDOW_TREE_DEFAULT_FORMAT \ + "#{?pane_format," \ + "#{pane_current_command} \"#{pane_title}\"" \ + "," \ + "#{?window_format," \ + "#{window_name}#{window_flags} " \ + "(#{window_panes} panes)" \ + "#{?#{==:#{window_panes},1}, \"#{pane_title}\",}" \ + "," \ + "#{session_windows} windows" \ + "#{?session_grouped, (group ,}" \ + "#{session_group}#{?session_grouped,),}" \ + "#{?session_attached, (attached),}" \ + "}" \ + "}" + const struct window_mode window_tree_mode = { .name = "tree-mode", *************** *** 73,78 **** --- 89,95 ---- int references; struct mode_tree_data *data; + char *format; char *command; struct window_tree_itemdata **item_list; *************** *** 215,223 **** item->winlink = wl->idx; item->pane = wp->id; ! text = format_single(NULL, ! "#{pane_current_command} \"#{pane_title}\"", ! NULL, s, wl, wp); xasprintf(&name, "%u", idx); mode_tree_add(data->data, parent, item, (uint64_t)wp, name, text, -1); --- 232,238 ---- item->winlink = wl->idx; item->pane = wp->id; ! text = format_single(NULL, data->format, NULL, s, wl, wp); xasprintf(&name, "%u", idx); mode_tree_add(data->data, parent, item, (uint64_t)wp, name, text, -1); *************** *** 243,252 **** item->winlink = wl->idx; item->pane = -1; ! text = format_single(NULL, ! "#{window_name}#{window_flags} (#{window_panes} panes)" ! "#{?#{==:#{window_panes},1}, \"#{pane_title}\",}", ! NULL, s, wl, NULL); xasprintf(&name, "%u", wl->idx); if (data->type == WINDOW_TREE_SESSION || --- 258,264 ---- item->winlink = wl->idx; item->pane = -1; ! text = format_single(NULL, data->format, NULL, s, wl, NULL); xasprintf(&name, "%u", wl->idx); if (data->type == WINDOW_TREE_SESSION || *************** *** 319,330 **** item->winlink = -1; item->pane = -1; ! text = format_single(NULL, ! "#{session_windows} windows" ! "#{?session_grouped, (group ,}" ! "#{session_group}#{?session_grouped,),}" ! "#{?session_attached, (attached),}", ! NULL, s, NULL, NULL); if (data->type == WINDOW_TREE_SESSION) expanded = 0; --- 331,337 ---- item->winlink = -1; item->pane = -1; ! text = format_single(NULL, data->format, NULL, s, NULL, NULL); if (data->type == WINDOW_TREE_SESSION) expanded = 0; *************** *** 755,760 **** --- 762,771 ---- data->wp = wp; data->references = 1; + if (args == NULL || !args_has(args, 'F')) + data->format = xstrdup(WINDOW_TREE_DEFAULT_FORMAT); + else + data->format = xstrdup(args_get(args, 'F')); if (args == NULL || args->argc == 0) data->command = xstrdup(WINDOW_TREE_DEFAULT_COMMAND); else *************** *** 786,792 **** --- 797,805 ---- window_tree_free_item(data->item_list[i]); free(data->item_list); + free(data->format); free(data->command); + free(data); }