=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-send-keys.c,v retrieving revision 1.33 retrieving revision 1.34 diff -c -r1.33 -r1.34 *** src/usr.bin/tmux/cmd-send-keys.c 2016/10/16 19:04:05 1.33 --- src/usr.bin/tmux/cmd-send-keys.c 2016/11/29 12:54:46 1.34 *************** *** 1,4 **** ! /* $OpenBSD: cmd-send-keys.c,v 1.33 2016/10/16 19:04:05 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-send-keys.c,v 1.34 2016/11/29 12:54:46 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott *************** *** 66,86 **** 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(item, "not in a mode"); - return (CMD_RETURN_ERROR); - } np = args_strtonum(args, 'N', 1, UINT_MAX, &cause); if (cause != NULL) { ! cmdq_error(item, "prefix %s", cause); free(cause); return (CMD_RETURN_ERROR); } - wp->modeprefix = np; } if (args_has(args, 'X')) { --- 66,81 ---- const u_char *keystr; int i, literal; key_code key; ! u_int np = 1; char *cause = NULL; if (args_has(args, 'N')) { np = args_strtonum(args, 'N', 1, UINT_MAX, &cause); if (cause != NULL) { ! cmdq_error(item, "repeat count %s", cause); free(cause); return (CMD_RETURN_ERROR); } } if (args_has(args, 'X')) { *************** *** 88,93 **** --- 83,89 ---- cmdq_error(item, "not in a mode"); return (CMD_RETURN_ERROR); } + wp->modeprefix = np; if (!m->valid) wp->mode->command(wp, c, s, args, NULL); else *************** *** 95,103 **** 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); if (wp == NULL) { --- 91,96 ---- *************** *** 120,138 **** if (args_has(args, 'R')) input_reset(wp, 1); ! for (i = 0; i < args->argc; i++) { ! literal = args_has(args, 'l'); ! if (!literal) { ! key = key_string_lookup_string(args->argv[i]); ! if (key != KEYC_NONE && key != KEYC_UNKNOWN) ! window_pane_key(wp, NULL, s, key, NULL); ! else ! literal = 1; } ! if (literal) { ! for (keystr = args->argv[i]; *keystr != '\0'; keystr++) ! window_pane_key(wp, NULL, s, *keystr, NULL); ! } } return (CMD_RETURN_NORMAL); --- 113,134 ---- if (args_has(args, 'R')) input_reset(wp, 1); ! for (; np != 0; np--) { ! for (i = 0; i < args->argc; i++) { ! literal = args_has(args, 'l'); ! if (!literal) { ! key = key_string_lookup_string(args->argv[i]); ! if (key != KEYC_NONE && key != KEYC_UNKNOWN) ! window_pane_key(wp, NULL, s, key, NULL); ! else ! literal = 1; ! } ! if (literal) { ! for (keystr = args->argv[i]; *keystr != '\0'; keystr++) ! window_pane_key(wp, NULL, s, *keystr, NULL); ! } } ! } return (CMD_RETURN_NORMAL);