Store state shared between multiple commands in the queue in a shared

structure.
This commit is contained in:
nicm
2017-04-21 14:01:19 +00:00
parent 311dad8c28
commit bba588752f
14 changed files with 68 additions and 43 deletions

25
tmux.h
View File

@ -41,6 +41,7 @@ extern char **environ;
struct args;
struct client;
struct cmdq_item;
struct cmdq_subitem;
struct cmdq_list;
struct environ;
struct input_ctx;
@ -1204,6 +1205,19 @@ enum cmdq_type {
CMDQ_CALLBACK,
};
/* Command queue item shared state. */
struct cmdq_shared {
int references;
int flags;
#define CMDQ_SHARED_REPEAT 0x1
struct format_tree *formats;
struct mouse_event mouse;
struct cmd_find_state current;
};
/* Command queue item. */
typedef enum cmd_retval (*cmdq_cb) (struct cmdq_item *, void *);
struct cmdq_item {
@ -1219,25 +1233,20 @@ struct cmdq_item {
u_int number;
time_t time;
struct format_tree *formats;
int flags;
#define CMDQ_FIRED 0x1
#define CMDQ_WAITING 0x2
#define CMDQ_NOHOOKS 0x4
struct cmdq_shared *shared;
struct cmd_list *cmdlist;
struct cmd *cmd;
int repeat;
cmdq_cb cb;
void *data;
struct cmd_find_state current;
struct cmd_state state;
struct mouse_event mouse;
TAILQ_ENTRY(cmdq_item) entry;
};
TAILQ_HEAD(cmdq_list, cmdq_item);
@ -1394,7 +1403,9 @@ TAILQ_HEAD(clients, client);
struct key_binding {
key_code key;
struct cmd_list *cmdlist;
int can_repeat;
int flags;
#define KEY_BINDING_REPEAT 0x1
RB_ENTRY(key_binding) entry;
};