=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-list-windows.c,v retrieving revision 1.43 retrieving revision 1.44 diff -c -r1.43 -r1.44 *** src/usr.bin/tmux/cmd-list-windows.c 2017/05/01 12:20:55 1.43 --- src/usr.bin/tmux/cmd-list-windows.c 2020/04/12 08:36:18 1.44 *************** *** 1,4 **** ! /* $OpenBSD: cmd-list-windows.c,v 1.43 2017/05/01 12:20:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-list-windows.c,v 1.44 2020/04/12 08:36:18 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 49,56 **** .name = "list-windows", .alias = "lsw", ! .args = { "F:at:", 0, 0 }, ! .usage = "[-a] [-F format] " CMD_TARGET_SESSION_USAGE, .target = { 't', CMD_FIND_SESSION, 0 }, --- 49,56 ---- .name = "list-windows", .alias = "lsw", ! .args = { "F:f:at:", 0, 0 }, ! .usage = "[-a] [-F format] [-f filter] " CMD_TARGET_SESSION_USAGE, .target = { 't', CMD_FIND_SESSION, 0 }, *************** *** 88,95 **** struct winlink *wl; u_int n; struct format_tree *ft; ! const char *template; ! char *line; template = args_get(args, 'F'); if (template == NULL) { --- 88,96 ---- struct winlink *wl; u_int n; struct format_tree *ft; ! const char *template, *filter; ! char *line, *expanded; ! int flag; template = args_get(args, 'F'); if (template == NULL) { *************** *** 102,107 **** --- 103,109 ---- break; } } + filter = args_get(args, 'f'); n = 0; RB_FOREACH(wl, winlinks, &s->windows) { *************** *** 109,117 **** format_add(ft, "line", "%u", n); format_defaults(ft, NULL, s, wl, NULL); ! line = format_expand(ft, template); ! cmdq_print(item, "%s", line); ! free(line); format_free(ft); n++; --- 111,127 ---- format_add(ft, "line", "%u", n); format_defaults(ft, NULL, s, wl, NULL); ! if (filter != NULL) { ! expanded = format_expand(ft, filter); ! flag = format_true(expanded); ! free(expanded); ! } else ! flag = 1; ! if (flag) { ! line = format_expand(ft, template); ! cmdq_print(item, "%s", line); ! free(line); ! } format_free(ft); n++;