mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-03 17:24:18 +00:00 
			
		
		
		
	Tidy up the terminal detection and feature code and add named sets of
terminal features, each of which are defined in one place and map to a builtin set of terminfo(5) capabilities. Features can be specified based on TERM with a new terminal-features option or with the -T flag when running tmux. tmux will also detect a few common terminals from the DA and DSR responses. This is intended to make it easier to configure tmux's use of terminfo(5) even in the presence of outdated ncurses(3) or terminfo(5) databases or for features which do not yet have a terminfo(5) entry. Instead of having to grok terminfo(5) capability names and what they should be set to in the terminal-overrides option, the user can hopefully just give tmux a feature name and let it do the right thing. The terminal-overrides option remains both for backwards compatibility and to allow tweaks of individual capabilities. tmux already did much of this already, this makes it tidier and simpler to configure.
This commit is contained in:
		
							
								
								
									
										30
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								tmux.h
									
									
									
									
									
								
							@@ -474,6 +474,7 @@ enum msgtype {
 | 
			
		||||
	MSG_IDENTIFY_DONE,
 | 
			
		||||
	MSG_IDENTIFY_CLIENTPID,
 | 
			
		||||
	MSG_IDENTIFY_CWD,
 | 
			
		||||
	MSG_IDENTIFY_FEATURES,
 | 
			
		||||
 | 
			
		||||
	MSG_COMMAND = 200,
 | 
			
		||||
	MSG_DETACH,
 | 
			
		||||
@@ -1176,7 +1177,8 @@ struct tty_key {
 | 
			
		||||
struct tty_code;
 | 
			
		||||
struct tty_term {
 | 
			
		||||
	char		*name;
 | 
			
		||||
	u_int		 references;
 | 
			
		||||
	struct tty	*tty;
 | 
			
		||||
	int		 features;
 | 
			
		||||
 | 
			
		||||
	char		 acs[UCHAR_MAX + 1][2];
 | 
			
		||||
 | 
			
		||||
@@ -1187,8 +1189,6 @@ struct tty_term {
 | 
			
		||||
#define TERM_DECSLRM 0x4
 | 
			
		||||
#define TERM_DECFRA 0x8
 | 
			
		||||
#define TERM_RGBCOLOURS 0x10
 | 
			
		||||
#define TERM_SYNC 0x20
 | 
			
		||||
#define TERM_UTF8 0x40
 | 
			
		||||
	int		 flags;
 | 
			
		||||
 | 
			
		||||
	LIST_ENTRY(tty_term) entry;
 | 
			
		||||
@@ -1252,8 +1252,6 @@ struct tty {
 | 
			
		||||
	int		 flags;
 | 
			
		||||
 | 
			
		||||
	struct tty_term	*term;
 | 
			
		||||
	char		*term_name;
 | 
			
		||||
	int		 term_flags;
 | 
			
		||||
 | 
			
		||||
	u_int		 mouse_last_x;
 | 
			
		||||
	u_int		 mouse_last_y;
 | 
			
		||||
@@ -1267,7 +1265,6 @@ struct tty {
 | 
			
		||||
	struct event	 key_timer;
 | 
			
		||||
	struct tty_key	*key_tree;
 | 
			
		||||
};
 | 
			
		||||
#define tty_term_flags(tty) (tty->term->flags|tty->term_flags)
 | 
			
		||||
 | 
			
		||||
/* TTY command context. */
 | 
			
		||||
struct tty_ctx {
 | 
			
		||||
@@ -1498,7 +1495,9 @@ struct client {
 | 
			
		||||
	char		*title;
 | 
			
		||||
	const char	*cwd;
 | 
			
		||||
 | 
			
		||||
	char		*term;
 | 
			
		||||
	char		*term_name;
 | 
			
		||||
	int		 term_features;
 | 
			
		||||
 | 
			
		||||
	char		*ttyname;
 | 
			
		||||
	struct tty	 tty;
 | 
			
		||||
 | 
			
		||||
@@ -1531,7 +1530,7 @@ struct client {
 | 
			
		||||
#define CLIENT_CONTROLCONTROL 0x4000
 | 
			
		||||
#define CLIENT_FOCUSED 0x8000
 | 
			
		||||
#define CLIENT_UTF8 0x10000
 | 
			
		||||
#define CLIENT_256COLOURS 0x20000
 | 
			
		||||
/* 0x20000 unused */
 | 
			
		||||
#define CLIENT_IDENTIFIED 0x40000
 | 
			
		||||
#define CLIENT_STATUSFORCE 0x80000
 | 
			
		||||
#define CLIENT_DOUBLECLICK 0x100000
 | 
			
		||||
@@ -1953,7 +1952,7 @@ void	tty_putcode_ptr2(struct tty *, enum tty_code_code, const void *,
 | 
			
		||||
void	tty_puts(struct tty *, const char *);
 | 
			
		||||
void	tty_putc(struct tty *, u_char);
 | 
			
		||||
void	tty_putn(struct tty *, const void *, size_t, u_int);
 | 
			
		||||
int	tty_init(struct tty *, struct client *, int, char *);
 | 
			
		||||
int	tty_init(struct tty *, struct client *, int);
 | 
			
		||||
void	tty_resize(struct tty *);
 | 
			
		||||
void	tty_set_size(struct tty *, u_int, u_int, u_int, u_int);
 | 
			
		||||
void	tty_start_tty(struct tty *);
 | 
			
		||||
@@ -1968,8 +1967,7 @@ void	tty_sync_end(struct tty *);
 | 
			
		||||
int	tty_open(struct tty *, char **);
 | 
			
		||||
void	tty_close(struct tty *);
 | 
			
		||||
void	tty_free(struct tty *);
 | 
			
		||||
void	tty_set_flags(struct tty *, int);
 | 
			
		||||
int	tty_get_flags(struct tty *);
 | 
			
		||||
void	tty_update_features(struct tty *);
 | 
			
		||||
void	tty_write(void (*)(struct tty *, const struct tty_ctx *),
 | 
			
		||||
	    struct tty_ctx *);
 | 
			
		||||
void	tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *);
 | 
			
		||||
@@ -1999,7 +1997,8 @@ void	tty_cmd_syncend(struct tty *, const struct tty_ctx *);
 | 
			
		||||
/* tty-term.c */
 | 
			
		||||
extern struct tty_terms tty_terms;
 | 
			
		||||
u_int		 tty_term_ncodes(void);
 | 
			
		||||
struct tty_term *tty_term_find(char *, int, char **);
 | 
			
		||||
void		 tty_term_apply(struct tty_term *, const char *, int);
 | 
			
		||||
struct tty_term *tty_term_create(struct tty *, char *, int *, int, char **);
 | 
			
		||||
void		 tty_term_free(struct tty_term *);
 | 
			
		||||
int		 tty_term_has(struct tty_term *, enum tty_code_code);
 | 
			
		||||
const char	*tty_term_string(struct tty_term *, enum tty_code_code);
 | 
			
		||||
@@ -2016,6 +2015,11 @@ int		 tty_term_number(struct tty_term *, enum tty_code_code);
 | 
			
		||||
int		 tty_term_flag(struct tty_term *, enum tty_code_code);
 | 
			
		||||
const char	*tty_term_describe(struct tty_term *, enum tty_code_code);
 | 
			
		||||
 | 
			
		||||
/* tty-features.c */
 | 
			
		||||
void		 tty_add_features(int *, const char *, const char *);
 | 
			
		||||
const char	*tty_get_features(int);
 | 
			
		||||
void		 tty_apply_features(struct tty_term *, int);
 | 
			
		||||
 | 
			
		||||
/* tty-acs.c */
 | 
			
		||||
int		 tty_acs_needed(struct tty *);
 | 
			
		||||
const char	*tty_acs_get(struct tty *, u_char);
 | 
			
		||||
@@ -2161,7 +2165,7 @@ void printflike(2, 3) cmdq_error(struct cmdq_item *, const char *, ...);
 | 
			
		||||
void	cmd_wait_for_flush(void);
 | 
			
		||||
 | 
			
		||||
/* client.c */
 | 
			
		||||
int	client_main(struct event_base *, int, char **, int);
 | 
			
		||||
int	client_main(struct event_base *, int, char **, int, int);
 | 
			
		||||
 | 
			
		||||
/* key-bindings.c */
 | 
			
		||||
struct key_table *key_bindings_get_table(const char *, int);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user