mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Make send -N work for all keys, not just in copy mode. From Artem Fokin.
This commit is contained in:
		@@ -66,21 +66,16 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
 | 
			
		||||
	const u_char		*keystr;
 | 
			
		||||
	int			 i, literal;
 | 
			
		||||
	key_code		 key;
 | 
			
		||||
	u_int			 np;
 | 
			
		||||
	u_int			 np = 1;
 | 
			
		||||
	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);
 | 
			
		||||
			cmdq_error(item, "repeat count %s", cause);
 | 
			
		||||
			free(cause);
 | 
			
		||||
			return (CMD_RETURN_ERROR);
 | 
			
		||||
		}
 | 
			
		||||
		wp->modeprefix = np;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (args_has(args, 'X')) {
 | 
			
		||||
@@ -88,6 +83,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
 | 
			
		||||
			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,9 +91,6 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
 | 
			
		||||
		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) {
 | 
			
		||||
@@ -120,6 +113,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
 | 
			
		||||
	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) {
 | 
			
		||||
@@ -135,5 +129,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return (CMD_RETURN_NORMAL);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user