mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Insert copy mode bindings at the right place in the command queue.
This commit is contained in:
		@@ -73,7 +73,7 @@ cmd_send_keys_inject(struct client *c, struct cmdq_item *item, key_code key)
 | 
				
			|||||||
	bd = RB_FIND(key_bindings, &table->key_bindings, &bd_find);
 | 
						bd = RB_FIND(key_bindings, &table->key_bindings, &bd_find);
 | 
				
			||||||
	if (bd != NULL) {
 | 
						if (bd != NULL) {
 | 
				
			||||||
		table->references++;
 | 
							table->references++;
 | 
				
			||||||
		key_bindings_dispatch(bd, c, NULL, &item->target);
 | 
							key_bindings_dispatch(bd, item, c, NULL, &item->target);
 | 
				
			||||||
		key_bindings_unref_table(table);
 | 
							key_bindings_unref_table(table);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -400,11 +400,11 @@ key_bindings_read_only(struct cmdq_item *item, __unused void *data)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
key_bindings_dispatch(struct key_binding *bd, struct client *c,
 | 
					key_bindings_dispatch(struct key_binding *bd, struct cmdq_item *item,
 | 
				
			||||||
    struct mouse_event *m, struct cmd_find_state *fs)
 | 
					    struct client *c, struct mouse_event *m, struct cmd_find_state *fs)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct cmd		*cmd;
 | 
						struct cmd		*cmd;
 | 
				
			||||||
	struct cmdq_item	*item;
 | 
						struct cmdq_item	*new_item;
 | 
				
			||||||
	int			 readonly;
 | 
						int			 readonly;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	readonly = 1;
 | 
						readonly = 1;
 | 
				
			||||||
@@ -413,11 +413,14 @@ key_bindings_dispatch(struct key_binding *bd, struct client *c,
 | 
				
			|||||||
			readonly = 0;
 | 
								readonly = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!readonly && (c->flags & CLIENT_READONLY))
 | 
						if (!readonly && (c->flags & CLIENT_READONLY))
 | 
				
			||||||
		cmdq_append(c, cmdq_get_callback(key_bindings_read_only, NULL));
 | 
							new_item = cmdq_get_callback(key_bindings_read_only, NULL);
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
		item = cmdq_get_command(bd->cmdlist, fs, m, 0);
 | 
							new_item = cmdq_get_command(bd->cmdlist, fs, m, 0);
 | 
				
			||||||
		if (bd->flags & KEY_BINDING_REPEAT)
 | 
							if (bd->flags & KEY_BINDING_REPEAT)
 | 
				
			||||||
			item->shared->flags |= CMDQ_SHARED_REPEAT;
 | 
								new_item->shared->flags |= CMDQ_SHARED_REPEAT;
 | 
				
			||||||
		cmdq_append(c, item);
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if (item != NULL)
 | 
				
			||||||
 | 
							cmdq_insert_after(item, new_item);
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							cmdq_append(c, new_item);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -947,7 +947,7 @@ retry:
 | 
				
			|||||||
		server_status_client(c);
 | 
							server_status_client(c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Execute the key binding. */
 | 
							/* Execute the key binding. */
 | 
				
			||||||
		key_bindings_dispatch(bd, c, m, &fs);
 | 
							key_bindings_dispatch(bd, NULL, c, m, &fs);
 | 
				
			||||||
		key_bindings_unref_table(table);
 | 
							key_bindings_unref_table(table);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1801,8 +1801,8 @@ void	 key_bindings_add(const char *, key_code, int, struct cmd_list *);
 | 
				
			|||||||
void	 key_bindings_remove(const char *, key_code);
 | 
					void	 key_bindings_remove(const char *, key_code);
 | 
				
			||||||
void	 key_bindings_remove_table(const char *);
 | 
					void	 key_bindings_remove_table(const char *);
 | 
				
			||||||
void	 key_bindings_init(void);
 | 
					void	 key_bindings_init(void);
 | 
				
			||||||
void	 key_bindings_dispatch(struct key_binding *, struct client *,
 | 
					void	 key_bindings_dispatch(struct key_binding *, struct cmdq_item *,
 | 
				
			||||||
	     struct mouse_event *, struct cmd_find_state *);
 | 
						     struct client *, struct mouse_event *, struct cmd_find_state *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* key-string.c */
 | 
					/* key-string.c */
 | 
				
			||||||
key_code	 key_string_lookup_string(const char *);
 | 
					key_code	 key_string_lookup_string(const char *);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user