version 1.33, 2020/04/13 14:04:25 |
version 1.34, 2020/04/13 15:55:51 |
|
|
}; |
}; |
|
|
static void |
static void |
notify_hook_formats(struct cmdq_item *item, struct session *s, struct window *w, |
notify_hook_formats(struct cmdq_state *state, struct session *s, |
int pane) |
struct window *w, int pane) |
{ |
{ |
if (s != NULL) { |
if (s != NULL) { |
cmdq_format(item, "hook_session", "$%u", s->id); |
cmdq_add_format(state, "hook_session", "$%u", s->id); |
cmdq_format(item, "hook_session_name", "%s", s->name); |
cmdq_add_format(state, "hook_session_name", "%s", s->name); |
} |
} |
if (w != NULL) { |
if (w != NULL) { |
cmdq_format(item, "hook_window", "@%u", w->id); |
cmdq_add_format(state, "hook_window", "@%u", w->id); |
cmdq_format(item, "hook_window_name", "%s", w->name); |
cmdq_add_format(state, "hook_window_name", "%s", w->name); |
} |
} |
if (pane != -1) |
if (pane != -1) |
cmdq_format(item, "hook_pane", "%%%d", pane); |
cmdq_add_format(state, "hook_pane", "%%%d", pane); |
} |
} |
|
|
static void |
static void |
|
|
struct cmd_find_state fs; |
struct cmd_find_state fs; |
struct options *oo; |
struct options *oo; |
struct cmdq_item *new_item; |
struct cmdq_item *new_item; |
|
struct cmdq_state *new_state; |
struct session *s = ne->session; |
struct session *s = ne->session; |
struct window *w = ne->window; |
struct window *w = ne->window; |
struct options_entry *o; |
struct options_entry *o; |
|
|
if (o == NULL) |
if (o == NULL) |
return; |
return; |
|
|
|
new_state = cmdq_new_state(&fs, NULL, CMDQ_STATE_NOHOOKS); |
|
cmdq_add_format(new_state, "hook", "%s", ne->name); |
|
notify_hook_formats(new_state, s, w, ne->pane); |
|
|
a = options_array_first(o); |
a = options_array_first(o); |
while (a != NULL) { |
while (a != NULL) { |
cmdlist = options_array_item_value(a)->cmdlist; |
cmdlist = options_array_item_value(a)->cmdlist; |
if (cmdlist == NULL) { |
if (cmdlist != NULL) { |
a = options_array_next(a); |
new_item = cmdq_get_command(cmdlist, new_state); |
continue; |
item = cmdq_insert_after(item, new_item); |
} |
} |
|
|
new_item = cmdq_get_command(cmdlist, &fs, NULL, |
|
CMDQ_STATE_NOHOOKS); |
|
cmdq_format(new_item, "hook", "%s", ne->name); |
|
notify_hook_formats(new_item, s, w, ne->pane); |
|
item = cmdq_insert_after(item, new_item); |
|
|
|
a = options_array_next(a); |
a = options_array_next(a); |
} |
} |
|
|
|
cmdq_free_state(new_state); |
} |
} |
|
|
static enum cmd_retval |
static enum cmd_retval |