diff options
author | nicm <nicm> | 2020-01-28 10:59:29 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-01-28 10:59:29 +0000 |
commit | 90e962fff8f4d251cdf7fcc653caa34973c82d91 (patch) | |
tree | dcde9271394f87819a0ed90a62abf86457f4c5fd | |
parent | f165221dc4641837ee9f589bb666d310a495904c (diff) | |
download | rtmux-90e962fff8f4d251cdf7fcc653caa34973c82d91.tar.gz rtmux-90e962fff8f4d251cdf7fcc653caa34973c82d91.tar.bz2 rtmux-90e962fff8f4d251cdf7fcc653caa34973c82d91.zip |
Add support for the iTerm2 DSR 1337 sequence to get the terminal version.
-rw-r--r-- | input.c | 9 | ||||
-rw-r--r-- | tty-keys.c | 2 |
2 files changed, 10 insertions, 1 deletions
@@ -20,6 +20,7 @@ #include <netinet/in.h> +#include <ctype.h> #include <resolv.h> #include <stdlib.h> #include <string.h> @@ -1301,6 +1302,7 @@ input_csi_dispatch(struct input_ctx *ictx) struct input_table_entry *entry; int i, n, m; u_int cx, bg = ictx->cell.cell.bg; + char *copy, *cp; if (ictx->flags & INPUT_DISCARD) return (0); @@ -1432,6 +1434,13 @@ input_csi_dispatch(struct input_ctx *ictx) case 6: input_reply(ictx, "\033[%u;%uR", s->cy + 1, s->cx + 1); break; + case 1337: /* Terminal version, from iTerm2. */ + copy = xstrdup(getversion()); + for (cp = copy; *cp != '\0'; cp++) + *cp = toupper((u_char)*cp); + input_reply(ictx, "\033[TMUX %sn", copy); + free(copy); + break; default: log_debug("%s: unknown '%c'", __func__, ictx->ch); break; @@ -1099,7 +1099,7 @@ tty_keys_device_status_report(struct tty *tty, const char *buf, size_t len, return (-1); if (len == 2) return (1); - if (buf[2] != 'I') + if (buf[2] != 'I' && buf[2] != 'T') return (-1); if (len == 3) return (1); |