summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-01-28 10:59:30 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-01-28 10:59:30 +0000
commit3178abb26c54f78a323cc35262e8490922bdc1bb (patch)
tree7abcdf2652bca43fddf9e9c1d2bda347eb340fa7 /usr.bin/tmux
parent5c4ddaec630b52a83f113fc6df6670e02a1740fb (diff)
Add support for the iTerm2 DSR 1337 sequence to get the terminal version.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/input.c11
-rw-r--r--usr.bin/tmux/tty-keys.c4
2 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index ab5e78b9dbd..9b2792a7c31 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.167 2019/11/28 09:50:09 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.168 2020/01/28 10:59:29 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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;
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index 3075acb51bf..c2101ac45f4 100644
--- a/usr.bin/tmux/tty-keys.c
+++ b/usr.bin/tmux/tty-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.120 2020/01/13 08:12:53 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.121 2020/01/28 10:59:29 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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);