diff options
author | 2019-03-28 21:05:15 +0000 | |
---|---|---|
committer | 2019-03-28 21:05:15 +0000 | |
commit | 00db7279209939e0053f085cfff44db68c7a06ab (patch) | |
tree | 602a3e59ce7a8a51fb2295937ca5384fd3997bc9 /usr.bin/tmux/window-buffer.c | |
parent | zap trailing whitespace; (diff) | |
download | wireguard-openbsd-00db7279209939e0053f085cfff44db68c7a06ab.tar.xz wireguard-openbsd-00db7279209939e0053f085cfff44db68c7a06ab.zip |
Expand session and window formats for buffer filters.
Diffstat (limited to 'usr.bin/tmux/window-buffer.c')
-rw-r--r-- | usr.bin/tmux/window-buffer.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/usr.bin/tmux/window-buffer.c b/usr.bin/tmux/window-buffer.c index de81cdda141..7d6438ddd02 100644 --- a/usr.bin/tmux/window-buffer.c +++ b/usr.bin/tmux/window-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-buffer.c,v 1.17 2019/03/18 14:10:25 nicm Exp $ */ +/* $OpenBSD: window-buffer.c,v 1.18 2019/03/28 21:05:15 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -67,6 +67,7 @@ struct window_buffer_itemdata { }; struct window_buffer_modedata { + struct cmd_find_state fs; struct mode_tree_data *data; char *command; char *format; @@ -138,6 +139,9 @@ window_buffer_build(void *modedata, u_int sort_type, __unused uint64_t *tag, struct paste_buffer *pb; char *text, *cp; struct format_tree *ft; + struct session *s = NULL; + struct winlink *wl = NULL; + struct window_pane *wp = NULL; for (i = 0; i < data->item_size; i++) window_buffer_free_item(data->item_list[i]); @@ -168,6 +172,12 @@ window_buffer_build(void *modedata, u_int sort_type, __unused uint64_t *tag, break; } + if (cmd_find_valid_state(&data->fs)) { + s = data->fs.s; + wl = data->fs.wl; + wp = data->fs.wp; + } + for (i = 0; i < data->item_size; i++) { item = data->item_list[i]; @@ -175,6 +185,7 @@ window_buffer_build(void *modedata, u_int sort_type, __unused uint64_t *tag, if (pb == NULL) continue; ft = format_create(NULL, NULL, FORMAT_NONE, 0); + format_defaults(ft, NULL, s, wl, wp); format_defaults_paste_buffer(ft, pb); if (filter != NULL) { @@ -254,14 +265,15 @@ window_buffer_search(__unused void *modedata, void *itemdata, const char *ss) } static struct screen * -window_buffer_init(struct window_mode_entry *wme, - __unused struct cmd_find_state *fs, struct args *args) +window_buffer_init(struct window_mode_entry *wme, struct cmd_find_state *fs, + struct args *args) { struct window_pane *wp = wme->wp; struct window_buffer_modedata *data; struct screen *s; wme->data = data = xcalloc(1, sizeof *data); + cmd_find_copy_state(&data->fs, fs); if (args == NULL || !args_has(args, 'F')) data->format = xstrdup(WINDOW_BUFFER_DEFAULT_FORMAT); |