diff options
Diffstat (limited to 'cmd-find-window.c')
-rw-r--r-- | cmd-find-window.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/cmd-find-window.c b/cmd-find-window.c index 647cc8fb..25155f7b 100644 --- a/cmd-find-window.c +++ b/cmd-find-window.c @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $OpenBSD$ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -28,6 +28,11 @@ * Find window containing text. */ +#define FIND_WINDOW_TEMPLATE \ + "#{window_index}: #{window_name} " \ + "[#{window_width}x#{window_height}] " \ + "(#{window_panes} panes) #{window_find_matches}" + enum cmd_retval cmd_find_window_exec(struct cmd *, struct cmd_q *); void cmd_find_window_callback(struct window_choose_data *); @@ -47,7 +52,6 @@ const struct cmd_entry cmd_find_window_entry = { "F:CNt:T", 1, 4, "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string", 0, - NULL, cmd_find_window_exec }; @@ -84,7 +88,8 @@ cmd_find_window_match_flags(struct args *args) void cmd_find_window_match(struct cmd_find_window_data_list *find_list, - int match_flags, struct winlink *wl, const char *str, const char *searchstr) + int match_flags, struct winlink *wl, const char *str, + const char *searchstr) { struct cmd_find_window_data find_data; struct window_pane *wp; @@ -157,7 +162,7 @@ cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq) xasprintf(&searchstr, "*%s*", str); RB_FOREACH(wm, winlinks, &s->windows) - cmd_find_window_match (&find_list, match_flags, wm, str, searchstr); + cmd_find_window_match(&find_list, match_flags, wm, str, searchstr); free(searchstr); if (ARRAY_LENGTH(&find_list) == 0) { @@ -189,9 +194,7 @@ cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq) format_add(cdata->ft, "line", "%u", i); format_add(cdata->ft, "window_find_matches", "%s", ARRAY_ITEM(&find_list, i).list_ctx); - format_session(cdata->ft, s); - format_winlink(cdata->ft, s, wm); - format_window_pane(cdata->ft, wm->window->active); + format_defaults(cdata->ft, NULL, s, wm, NULL); window_choose_add(wl->window->active, cdata); } @@ -199,6 +202,8 @@ cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq) window_choose_ready(wl->window->active, 0, cmd_find_window_callback); out: + for (i = 0; i < ARRAY_LENGTH(&find_list); i++) + free(ARRAY_ITEM(&find_list, i).list_ctx); ARRAY_FREE(&find_list); return (CMD_RETURN_NORMAL); } |