version 1.44, 2018/12/18 13:20:44 |
version 1.45, 2019/03/07 20:24:21 |
|
|
static void |
static void |
cmd_send_keys_inject(struct client *c, struct cmdq_item *item, key_code key) |
cmd_send_keys_inject(struct client *c, struct cmdq_item *item, key_code key) |
{ |
{ |
struct window_pane *wp = item->target.wp; |
struct window_pane *wp = item->target.wp; |
struct session *s = item->target.s; |
struct session *s = item->target.s; |
struct winlink *wl = item->target.wl; |
struct winlink *wl = item->target.wl; |
struct key_table *table; |
struct window_mode_entry *wme = wp->mode; |
struct key_binding *bd; |
struct key_table *table; |
|
struct key_binding *bd; |
|
|
if (wp->mode == NULL || wp->mode->key_table == NULL) { |
if (wme == NULL || wme->mode->key_table == NULL) { |
if (options_get_number(wp->window->options, "xterm-keys")) |
if (options_get_number(wp->window->options, "xterm-keys")) |
key |= KEYC_XTERM; |
key |= KEYC_XTERM; |
window_pane_key(wp, NULL, s, wl, key, NULL); |
window_pane_key(wp, NULL, s, wl, key, NULL); |
return; |
return; |
} |
} |
table = key_bindings_get_table(wp->mode->key_table(wp), 1); |
table = key_bindings_get_table(wme->mode->key_table(wme), 1); |
|
|
bd = key_bindings_get(table, key & ~KEYC_XTERM); |
bd = key_bindings_get(table, key & ~KEYC_XTERM); |
if (bd != NULL) { |
if (bd != NULL) { |
|
|
static enum cmd_retval |
static enum cmd_retval |
cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item) |
cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct client *c = cmd_find_client(item, NULL, 1); |
struct client *c = cmd_find_client(item, NULL, 1); |
struct window_pane *wp = item->target.wp; |
struct window_pane *wp = item->target.wp; |
struct session *s = item->target.s; |
struct session *s = item->target.s; |
struct winlink *wl = item->target.wl; |
struct winlink *wl = item->target.wl; |
struct mouse_event *m = &item->shared->mouse; |
struct mouse_event *m = &item->shared->mouse; |
struct utf8_data *ud, *uc; |
struct window_mode_entry *wme = wp->mode; |
wchar_t wc; |
struct utf8_data *ud, *uc; |
int i, literal; |
wchar_t wc; |
key_code key; |
int i, literal; |
u_int np = 1; |
key_code key; |
char *cause = NULL; |
u_int np = 1; |
|
char *cause = NULL; |
|
|
if (args_has(args, 'N')) { |
if (args_has(args, 'N')) { |
np = args_strtonum(args, 'N', 1, UINT_MAX, &cause); |
np = args_strtonum(args, 'N', 1, UINT_MAX, &cause); |
|
|
free(cause); |
free(cause); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
} |
} |
if (args_has(args, 'X') || args->argc == 0) |
if (wme != NULL && (args_has(args, 'X') || args->argc == 0)) |
wp->modeprefix = np; |
wme->prefix = np; |
} |
} |
|
|
if (args_has(args, 'X')) { |
if (args_has(args, 'X')) { |
if (wp->mode == NULL || wp->mode->command == NULL) { |
if (wme == NULL || wme->mode->command == NULL) { |
cmdq_error(item, "not in a mode"); |
cmdq_error(item, "not in a mode"); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
} |
} |
if (!m->valid) |
if (!m->valid) |
wp->mode->command(wp, c, s, wl, args, NULL); |
m = NULL; |
else |
wme->mode->command(wme, c, s, wl, args, m); |
wp->mode->command(wp, c, s, wl, args, m); |
|
return (CMD_RETURN_NORMAL); |
return (CMD_RETURN_NORMAL); |
} |
} |
|
|