mirror of
https://github.com/tmux/tmux.git
synced 2025-01-05 23:38:48 +00:00
Expand session and window formats for buffer filters.
This commit is contained in:
parent
c1f0918f8a
commit
08bc226527
17
format.c
17
format.c
@ -1804,6 +1804,23 @@ void
|
||||
format_defaults(struct format_tree *ft, struct client *c, struct session *s,
|
||||
struct winlink *wl, struct window_pane *wp)
|
||||
{
|
||||
if (c != NULL)
|
||||
log_debug("%s: c=%s", __func__, c->name);
|
||||
else
|
||||
log_debug("%s: s=none", __func__);
|
||||
if (s != NULL)
|
||||
log_debug("%s: s=$%u", __func__, s->id);
|
||||
else
|
||||
log_debug("%s: s=none", __func__);
|
||||
if (wl != NULL)
|
||||
log_debug("%s: wl=%u w=@%u", __func__, wl->idx, wl->window->id);
|
||||
else
|
||||
log_debug("%s: wl=none", __func__);
|
||||
if (wp != NULL)
|
||||
log_debug("%s: wp=%%%u", __func__, wp->id);
|
||||
else
|
||||
log_debug("%s: wp=none", __func__);
|
||||
|
||||
if (c != NULL && s != NULL && c->session != s)
|
||||
log_debug("%s: session does not match", __func__);
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user