diff --git a/cmd-send-keys.c b/cmd-send-keys.c index 377453b0..7b0b952c 100644 --- a/cmd-send-keys.c +++ b/cmd-send-keys.c @@ -86,7 +86,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq) } if (args_has(args, 'R')) - input_reset(wp); + input_reset(wp, 1); for (i = 0; i < args->argc; i++) { literal = args_has(args, 'l'); diff --git a/input.c b/input.c index d8e80afb..ed1ebffc 100644 --- a/input.c +++ b/input.c @@ -762,24 +762,12 @@ input_init(struct window_pane *wp) ictx = wp->ictx = xcalloc(1, sizeof *ictx); - input_reset_cell(ictx); - - *ictx->interm_buf = '\0'; - ictx->interm_len = 0; - - *ictx->param_buf = '\0'; - ictx->param_len = 0; - ictx->input_space = INPUT_BUF_START; ictx->input_buf = xmalloc(INPUT_BUF_START); - *ictx->input_buf = '\0'; - ictx->input_len = 0; - - ictx->state = &input_state_ground; - ictx->flags = 0; - ictx->since_ground = evbuffer_new(); + + input_reset(wp, 0); } /* Destroy input parser. */ @@ -797,18 +785,32 @@ input_free(struct window_pane *wp) /* Reset input state and clear screen. */ void -input_reset(struct window_pane *wp) +input_reset(struct window_pane *wp, int clear) { struct input_ctx *ictx = wp->ictx; input_reset_cell(ictx); - if (wp->mode == NULL) - screen_write_start(&ictx->ctx, wp, &wp->base); - else - screen_write_start(&ictx->ctx, NULL, &wp->base); - screen_write_reset(&ictx->ctx); - screen_write_stop(&ictx->ctx); + if (clear) { + if (wp->mode == NULL) + screen_write_start(&ictx->ctx, wp, &wp->base); + else + screen_write_start(&ictx->ctx, NULL, &wp->base); + screen_write_reset(&ictx->ctx); + screen_write_stop(&ictx->ctx); + } + + *ictx->interm_buf = '\0'; + ictx->interm_len = 0; + + *ictx->param_buf = '\0'; + ictx->param_len = 0; + + *ictx->input_buf = '\0'; + ictx->input_len = 0; + + ictx->state = &input_state_ground; + ictx->flags = 0; } /* Return pending data. */ diff --git a/tmux.h b/tmux.h index 2b1b29b0..194d01d8 100644 --- a/tmux.h +++ b/tmux.h @@ -1379,6 +1379,7 @@ struct cmd_q { struct cmd *cmd; struct cmd_q *parent; + struct cmd_find_state current; struct cmd_state state; time_t time; @@ -1576,6 +1577,7 @@ void format_defaults_paste_buffer(struct format_tree *, /* hooks.c */ struct hook; +struct hooks *hooks_get(struct session *); struct hooks *hooks_create(struct hooks *); void hooks_free(struct hooks *); struct hook *hooks_first(struct hooks *); @@ -1584,10 +1586,10 @@ void hooks_add(struct hooks *, const char *, struct cmd_list *); void hooks_copy(struct hooks *, struct hooks *); void hooks_remove(struct hooks *, const char *); struct hook *hooks_find(struct hooks *, const char *); -int printflike(3, 4) hooks_run(struct hooks *, struct client *, const char *, - ...); -int printflike(3, 4) hooks_wait(struct hooks *, struct cmd_q *, const char *, - ...); +int printflike(4, 5) hooks_run(struct hooks *, struct client *, + struct cmd_find_state *, const char *, ...); +int printflike(4, 5) hooks_wait(struct hooks *, struct cmd_q *, + struct cmd_find_state *, const char *, ...); /* mode-key.c */ extern const struct mode_key_table mode_key_tables[]; @@ -1776,6 +1778,11 @@ int cmd_find_valid_state(struct cmd_find_state *); void cmd_find_copy_state(struct cmd_find_state *, struct cmd_find_state *); void cmd_find_log_state(const char *, struct cmd_find_state *); +int cmd_find_from_session(struct cmd_find_state *, + struct session *); +int cmd_find_from_window(struct cmd_find_state *, struct window *); +int cmd_find_from_pane(struct cmd_find_state *, + struct window_pane *); /* cmd.c */ int cmd_pack_argv(int, char **, char *, size_t); @@ -1896,7 +1903,7 @@ void server_kill_window(struct window *); int server_link_window(struct session *, struct winlink *, struct session *, int, int, int, char **); void server_unlink_window(struct session *, struct winlink *); -void server_destroy_pane(struct window_pane *); +void server_destroy_pane(struct window_pane *, int); void server_destroy_session_group(struct session *); void server_destroy_session(struct session *); void server_check_unattached(void); @@ -1930,7 +1937,7 @@ void recalculate_sizes(void); /* input.c */ void input_init(struct window_pane *); void input_free(struct window_pane *); -void input_reset(struct window_pane *); +void input_reset(struct window_pane *, int); struct evbuffer *input_pending(struct window_pane *); void input_parse(struct window_pane *);