From c91b4b2e142b5b3fc9ca88afec6bfa9b2711e01b Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 20 Apr 2020 13:25:36 +0000 Subject: 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. --- client.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index c1d6e1b5..98565c5d 100644 --- a/client.c +++ b/client.c @@ -57,7 +57,7 @@ static struct client_files client_files = RB_INITIALIZER(&client_files); static __dead void client_exec(const char *,const char *); static int client_get_lock(char *); static int client_connect(struct event_base *, const char *, int); -static void client_send_identify(const char *, const char *); +static void client_send_identify(const char *, const char *, int); static void client_signal(int); static void client_dispatch(struct imsg *, void *); static void client_dispatch_attached(struct imsg *); @@ -233,7 +233,7 @@ client_exit(void) /* Client main loop. */ int -client_main(struct event_base *base, int argc, char **argv, int flags) +client_main(struct event_base *base, int argc, char **argv, int flags, int feat) { struct cmd_parse_result *pr; struct msg_command *data; @@ -340,7 +340,7 @@ client_main(struct event_base *base, int argc, char **argv, int flags) } /* Send identify messages. */ - client_send_identify(ttynam, cwd); + client_send_identify(ttynam, cwd, feat); /* Send first command. */ if (msg == MSG_COMMAND) { @@ -406,7 +406,7 @@ client_main(struct event_base *base, int argc, char **argv, int flags) /* Send identify messages to server. */ static void -client_send_identify(const char *ttynam, const char *cwd) +client_send_identify(const char *ttynam, const char *cwd, int feat) { const char *s; char **ss; @@ -419,6 +419,7 @@ client_send_identify(const char *ttynam, const char *cwd) if ((s = getenv("TERM")) == NULL) s = ""; proc_send(client_peer, MSG_IDENTIFY_TERM, -1, s, strlen(s) + 1); + proc_send(client_peer, MSG_IDENTIFY_FEATURES, -1, &feat, sizeof feat); proc_send(client_peer, MSG_IDENTIFY_TTYNAME, -1, ttynam, strlen(ttynam) + 1); -- cgit v1.2.3