=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-send-keys.c,v retrieving revision 1.29 retrieving revision 1.30 diff -c -r1.29 -r1.30 *** src/usr.bin/tmux/cmd-send-keys.c 2016/10/10 21:51:39 1.29 --- src/usr.bin/tmux/cmd-send-keys.c 2016/10/11 07:23:34 1.30 *************** *** 1,4 **** ! /* $OpenBSD: cmd-send-keys.c,v 1.29 2016/10/10 21:51:39 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-send-keys.c,v 1.30 2016/10/11 07:23:34 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott *************** *** 33,40 **** .name = "send-keys", .alias = "send", ! .args = { "lRMt:", 0, -1 }, ! .usage = "[-lRM] " CMD_TARGET_PANE_USAGE " key ...", .tflag = CMD_PANE, --- 33,40 ---- .name = "send-keys", .alias = "send", ! .args = { "lXRMN:t:", 0, -1 }, ! .usage = "[-lXRM] [-N repeat-count] " CMD_TARGET_PANE_USAGE " key ...", .tflag = CMD_PANE, *************** *** 59,70 **** --- 59,102 ---- cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; + struct client *c = cmdq->state.c; struct window_pane *wp = cmdq->state.tflag.wp; struct session *s = cmdq->state.tflag.s; struct mouse_event *m = &cmdq->item->mouse; const u_char *keystr; int i, literal; key_code key; + u_int np; + char *cause = NULL; + + if (args_has(args, 'N')) { + if (wp->mode == NULL || wp->mode->command == NULL) { + cmdq_error(cmdq, "not in a mode"); + return (CMD_RETURN_ERROR); + } + np = args_strtonum(args, 'N', 1, UINT_MAX, &cause); + if (cause != NULL) { + cmdq_error(cmdq, "prefix %s", cause); + free(cause); + return (CMD_RETURN_ERROR); + } + wp->modeprefix = np; + } + + if (args_has(args, 'X')) { + if (wp->mode == NULL || wp->mode->command == NULL) { + cmdq_error(cmdq, "not in a mode"); + return (CMD_RETURN_ERROR); + } + if (!m->valid) + wp->mode->command(wp, c, s, args, NULL); + else + wp->mode->command(wp, c, s, args, m); + return (CMD_RETURN_NORMAL); + } + + if (args_has(args, 'N')) /* only with -X */ + return (CMD_RETURN_NORMAL); if (args_has(args, 'M')) { wp = cmd_mouse_pane(m, &s, NULL);