From 90e962fff8f4d251cdf7fcc653caa34973c82d91 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 28 Jan 2020 10:59:29 +0000 Subject: Add support for the iTerm2 DSR 1337 sequence to get the terminal version. --- input.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'input.c') diff --git a/input.c b/input.c index 452eac7f..d7071bfe 100644 --- a/input.c +++ b/input.c @@ -20,6 +20,7 @@ #include +#include #include #include #include @@ -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; -- cgit