aboutsummaryrefslogtreecommitdiff
path: root/csi.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-24 15:47:47 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-24 15:47:47 +0000
commit60984e7a2476e81ffe9d356d6e4cb11e218d812e (patch)
tree6a821f316b022c5f6cac9129c9c86a82ea00dd5a /csi.c
parentcsi: primary DA: remove features we do not support (diff)
csi: secondary DA: do not pretend we're xterm
Previously, our secondary DA response indicated a) VT420, b) an XTerm version number. Now, we indicate VT220 (which corresponds to the primary DA response), and we report foot's version number as MMmmpp. I.e major, minor and patch versions, using two digits. E.g. 1.4.2 is encoded as 010402
Diffstat (limited to 'csi.c')
-rw-r--r--csi.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/csi.c b/csi.c
index 044c6e3f..2122d272 100644
--- a/csi.c
+++ b/csi.c
@@ -13,10 +13,11 @@
#define LOG_ENABLE_DBG 0
#include "log.h"
#include "grid.h"
-#include "vt.h"
#include "selection.h"
#include "sixel.h"
#include "util.h"
+#include "version.h"
+#include "vt.h"
#define UNHANDLED() LOG_DBG("unhandled: %s", csi_as_string(term, final, -1))
#define UNHANDLED_SGR(idx) LOG_DBG("unhandled: %s", csi_as_string(term, 'm', idx))
@@ -1414,9 +1415,22 @@ csi_dispatch(struct terminal *term, uint8_t final)
* xterm uses its version number. We use an xterm
* version number too, since e.g. Emacs uses this to
* determine level of support.
+ *
+ * We report ourselves as a VT220. This must be
+ * synchronized with the primary DA respons.
+ *
+ * Note: tertiary DA replies with "FOOT".
*/
- term_to_slave(term, "\033[>41;347;0c", 12);
+ static_assert(FOOT_MAJOR < 100, "Major version must not exceed 99");
+ static_assert(FOOT_MINOR < 100, "Minor version must not exceed 99");
+ static_assert(FOOT_PATCH < 100, "Patch version must not exceed 99");
+
+ char reply[64];
+ snprintf(reply, sizeof(reply), "\033[>1;%02u%02u%02u;0c",
+ FOOT_MAJOR, FOOT_MINOR, FOOT_PATCH);
+
+ term_to_slave(term, reply, strlen(reply));
break;
case 'm':