mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Add another couple of keys needed for extended keys, GitHub issue 2658.
Handle modifier 9 as Meta, GitHub issue 2647.
This commit is contained in:
		@@ -215,6 +215,9 @@ key_bindings_add(const char *name, key_code key, const char *note, int repeat,
 | 
				
			|||||||
	if (repeat)
 | 
						if (repeat)
 | 
				
			||||||
		bd->flags |= KEY_BINDING_REPEAT;
 | 
							bd->flags |= KEY_BINDING_REPEAT;
 | 
				
			||||||
	bd->cmdlist = cmdlist;
 | 
						bd->cmdlist = cmdlist;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						log_debug("%s: %#llx %s = %s", __func__, bd->key,
 | 
				
			||||||
 | 
						    key_string_lookup_key(bd->key, 1), cmd_list_print(bd->cmdlist, 0));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
@@ -231,6 +234,9 @@ key_bindings_remove(const char *name, key_code key)
 | 
				
			|||||||
	if (bd == NULL)
 | 
						if (bd == NULL)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						log_debug("%s: %#llx %s", __func__, bd->key,
 | 
				
			||||||
 | 
						    key_string_lookup_key(bd->key, 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	RB_REMOVE(key_bindings, &table->key_bindings, bd);
 | 
						RB_REMOVE(key_bindings, &table->key_bindings, bd);
 | 
				
			||||||
	key_bindings_free(bd);
 | 
						key_bindings_free(bd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								key-string.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								key-string.c
									
									
									
									
									
								
							@@ -164,7 +164,7 @@ key_string_get_modifiers(const char **string)
 | 
				
			|||||||
key_code
 | 
					key_code
 | 
				
			||||||
key_string_lookup_string(const char *string)
 | 
					key_string_lookup_string(const char *string)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	static const char	*other = "!#()+,-.0123456789:;<=>'\r\t\177";
 | 
						static const char	*other = "!#()+,-.0123456789:;<=>'\r\t\177`/";
 | 
				
			||||||
	key_code		 key, modifiers;
 | 
						key_code		 key, modifiers;
 | 
				
			||||||
	u_int			 u, i;
 | 
						u_int			 u, i;
 | 
				
			||||||
	struct utf8_data	 ud, *udp;
 | 
						struct utf8_data	 ud, *udp;
 | 
				
			||||||
@@ -238,8 +238,12 @@ key_string_lookup_string(const char *string)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Convert the standard control keys. */
 | 
						/* Convert the standard control keys. */
 | 
				
			||||||
	if (key < KEYC_BASE && (modifiers & KEYC_CTRL) &&
 | 
						if (key < KEYC_BASE &&
 | 
				
			||||||
	    strchr(other, key) == NULL) {
 | 
						    (modifiers & KEYC_CTRL) &&
 | 
				
			||||||
 | 
						    strchr(other, key) == NULL &&
 | 
				
			||||||
 | 
						    key != 9 &&
 | 
				
			||||||
 | 
						    key != 13 &&
 | 
				
			||||||
 | 
						    key != 27) {
 | 
				
			||||||
		if (key >= 97 && key <= 122)
 | 
							if (key >= 97 && key <= 122)
 | 
				
			||||||
			key -= 96;
 | 
								key -= 96;
 | 
				
			||||||
		else if (key >= 64 && key <= 95)
 | 
							else if (key >= 64 && key <= 95)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								tty-keys.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								tty-keys.c
									
									
									
									
									
								
							@@ -252,7 +252,8 @@ static const key_code tty_default_xterm_modifiers[] = {
 | 
				
			|||||||
	KEYC_CTRL,
 | 
						KEYC_CTRL,
 | 
				
			||||||
	KEYC_SHIFT|KEYC_CTRL,
 | 
						KEYC_SHIFT|KEYC_CTRL,
 | 
				
			||||||
	KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL,
 | 
						KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL,
 | 
				
			||||||
	KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL
 | 
						KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL,
 | 
				
			||||||
 | 
						KEYC_META|KEYC_IMPLIED_META
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
@@ -944,6 +945,9 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
 | 
				
			|||||||
	case 8:
 | 
						case 8:
 | 
				
			||||||
		nkey |= (KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL);
 | 
							nkey |= (KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
						case 9:
 | 
				
			||||||
 | 
							nkey |= (KEYC_META|KEYC_IMPLIED_META);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		*key = KEYC_NONE;
 | 
							*key = KEYC_NONE;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
@@ -955,7 +959,10 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (nkey & KEYC_CTRL) {
 | 
						if (nkey & KEYC_CTRL) {
 | 
				
			||||||
		onlykey = (nkey & KEYC_MASK_KEY);
 | 
							onlykey = (nkey & KEYC_MASK_KEY);
 | 
				
			||||||
		if (onlykey < 32 && onlykey != 9)
 | 
							if (onlykey < 32 &&
 | 
				
			||||||
 | 
							    onlykey != 9 &&
 | 
				
			||||||
 | 
							    onlykey != 13 &&
 | 
				
			||||||
 | 
							    onlykey != 27)
 | 
				
			||||||
			/* nothing */;
 | 
								/* nothing */;
 | 
				
			||||||
		else if (onlykey >= 97 && onlykey <= 122)
 | 
							else if (onlykey >= 97 && onlykey <= 122)
 | 
				
			||||||
			onlykey -= 96;
 | 
								onlykey -= 96;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user