mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Add user-keys option to allow user-defined keys to be set, from Dan
Aloni.
This commit is contained in:
		
							
								
								
									
										14
									
								
								tty-keys.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								tty-keys.c
									
									
									
									
									
								
							@@ -389,8 +389,9 @@ tty_keys_build(struct tty *tty)
 | 
			
		||||
{
 | 
			
		||||
	const struct tty_default_key_raw	*tdkr;
 | 
			
		||||
	const struct tty_default_key_code	*tdkc;
 | 
			
		||||
	u_int		 			 i;
 | 
			
		||||
	const char				*s;
 | 
			
		||||
	u_int		 			 i, size;
 | 
			
		||||
	const char				*s, *value;
 | 
			
		||||
	struct options_entry			*o;
 | 
			
		||||
 | 
			
		||||
	if (tty->key_tree != NULL)
 | 
			
		||||
		tty_keys_free(tty);
 | 
			
		||||
@@ -411,6 +412,15 @@ tty_keys_build(struct tty *tty)
 | 
			
		||||
			tty_keys_add(tty, s, tdkc->key);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	o = options_get(global_options, "user-keys");
 | 
			
		||||
	if (o != NULL && options_array_size(o, &size) != -1) {
 | 
			
		||||
		for (i = 0; i < size; i++) {
 | 
			
		||||
			value = options_array_get(o, i);
 | 
			
		||||
			if (value != NULL)
 | 
			
		||||
				tty_keys_add(tty, value, KEYC_USER + i);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Free the entire key tree. */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user