mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
send-keys -R should reset the input parser to ground state (so it can be
used to escape from, for example, printf '\033]2;').
This commit is contained in:
parent
021c64310d
commit
99e9a4c786
@ -86,7 +86,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args_has(args, 'R'))
|
if (args_has(args, 'R'))
|
||||||
input_reset(wp);
|
input_reset(wp, 1);
|
||||||
|
|
||||||
for (i = 0; i < args->argc; i++) {
|
for (i = 0; i < args->argc; i++) {
|
||||||
literal = args_has(args, 'l');
|
literal = args_has(args, 'l');
|
||||||
|
44
input.c
44
input.c
@ -762,24 +762,12 @@ input_init(struct window_pane *wp)
|
|||||||
|
|
||||||
ictx = wp->ictx = xcalloc(1, sizeof *ictx);
|
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_space = INPUT_BUF_START;
|
||||||
ictx->input_buf = xmalloc(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();
|
ictx->since_ground = evbuffer_new();
|
||||||
|
|
||||||
|
input_reset(wp, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy input parser. */
|
/* Destroy input parser. */
|
||||||
@ -797,18 +785,32 @@ input_free(struct window_pane *wp)
|
|||||||
|
|
||||||
/* Reset input state and clear screen. */
|
/* Reset input state and clear screen. */
|
||||||
void
|
void
|
||||||
input_reset(struct window_pane *wp)
|
input_reset(struct window_pane *wp, int clear)
|
||||||
{
|
{
|
||||||
struct input_ctx *ictx = wp->ictx;
|
struct input_ctx *ictx = wp->ictx;
|
||||||
|
|
||||||
input_reset_cell(ictx);
|
input_reset_cell(ictx);
|
||||||
|
|
||||||
if (wp->mode == NULL)
|
if (clear) {
|
||||||
screen_write_start(&ictx->ctx, wp, &wp->base);
|
if (wp->mode == NULL)
|
||||||
else
|
screen_write_start(&ictx->ctx, wp, &wp->base);
|
||||||
screen_write_start(&ictx->ctx, NULL, &wp->base);
|
else
|
||||||
screen_write_reset(&ictx->ctx);
|
screen_write_start(&ictx->ctx, NULL, &wp->base);
|
||||||
screen_write_stop(&ictx->ctx);
|
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. */
|
/* Return pending data. */
|
||||||
|
19
tmux.h
19
tmux.h
@ -1379,6 +1379,7 @@ struct cmd_q {
|
|||||||
struct cmd *cmd;
|
struct cmd *cmd;
|
||||||
struct cmd_q *parent;
|
struct cmd_q *parent;
|
||||||
|
|
||||||
|
struct cmd_find_state current;
|
||||||
struct cmd_state state;
|
struct cmd_state state;
|
||||||
|
|
||||||
time_t time;
|
time_t time;
|
||||||
@ -1576,6 +1577,7 @@ void format_defaults_paste_buffer(struct format_tree *,
|
|||||||
|
|
||||||
/* hooks.c */
|
/* hooks.c */
|
||||||
struct hook;
|
struct hook;
|
||||||
|
struct hooks *hooks_get(struct session *);
|
||||||
struct hooks *hooks_create(struct hooks *);
|
struct hooks *hooks_create(struct hooks *);
|
||||||
void hooks_free(struct hooks *);
|
void hooks_free(struct hooks *);
|
||||||
struct hook *hooks_first(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_copy(struct hooks *, struct hooks *);
|
||||||
void hooks_remove(struct hooks *, const char *);
|
void hooks_remove(struct hooks *, const char *);
|
||||||
struct hook *hooks_find(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(4, 5) hooks_run(struct hooks *, struct client *,
|
||||||
...);
|
struct cmd_find_state *, const char *, ...);
|
||||||
int printflike(3, 4) hooks_wait(struct hooks *, struct cmd_q *, const char *,
|
int printflike(4, 5) hooks_wait(struct hooks *, struct cmd_q *,
|
||||||
...);
|
struct cmd_find_state *, const char *, ...);
|
||||||
|
|
||||||
/* mode-key.c */
|
/* mode-key.c */
|
||||||
extern const struct mode_key_table mode_key_tables[];
|
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 *,
|
void cmd_find_copy_state(struct cmd_find_state *,
|
||||||
struct cmd_find_state *);
|
struct cmd_find_state *);
|
||||||
void cmd_find_log_state(const char *, 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 */
|
/* cmd.c */
|
||||||
int cmd_pack_argv(int, char **, char *, size_t);
|
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 *,
|
int server_link_window(struct session *,
|
||||||
struct winlink *, struct session *, int, int, int, char **);
|
struct winlink *, struct session *, int, int, int, char **);
|
||||||
void server_unlink_window(struct session *, struct winlink *);
|
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_group(struct session *);
|
||||||
void server_destroy_session(struct session *);
|
void server_destroy_session(struct session *);
|
||||||
void server_check_unattached(void);
|
void server_check_unattached(void);
|
||||||
@ -1930,7 +1937,7 @@ void recalculate_sizes(void);
|
|||||||
/* input.c */
|
/* input.c */
|
||||||
void input_init(struct window_pane *);
|
void input_init(struct window_pane *);
|
||||||
void input_free(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 *);
|
struct evbuffer *input_pending(struct window_pane *);
|
||||||
void input_parse(struct window_pane *);
|
void input_parse(struct window_pane *);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user