aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-02-16 11:00:58 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-06-13 15:19:41 +0000
commit3adc3367e69e1b1c13595167cb0dbeb48391ca83 (patch)
tree541797aefe25bda8bf1aa328c175b7b0c9928ce0
parentgenerate-version: add a define for “extra” version information (diff)
csi: implement XTVERSION (CSI > 0q)
This is a fairly new XTerm extension. The reply is on the format: DCS > | text ST XTerm replies with ‘text’ = “XTerm(366)”. Foot replies with ‘text’ = “foot(1.6.4)” Closes #359
-rw-r--r--CHANGELOG.md3
-rw-r--r--csi.c16
2 files changed, 19 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ad10db9..3ec5ccb8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -301,6 +301,9 @@
(https://codeberg.org/dnkl/foot/issues/395).
* Completions for Bash shell
(https://codeberg.org/dnkl/foot/issues/10).
+* Implement `XTVERSION` (`CSI > 0q`). Foot will reply with
+ `DCS>|foot(<major>.<minor>.<patch>)ST`
+ (https://codeberg.org/dnkl/foot/issues/359).
### Changed
diff --git a/csi.c b/csi.c
index 2d497636..fcc2800f 100644
--- a/csi.c
+++ b/csi.c
@@ -1565,6 +1565,22 @@ csi_dispatch(struct terminal *term, uint8_t final)
}
break; /* final == 'm' */
+ case 'q': {
+ /* XTVERSION */
+ if (vt_param_get(term, 0, 0) != 0) {
+ UNHANDLED();
+ break;
+ }
+
+ char reply[64];
+ size_t n = xsnprintf(
+ reply, sizeof(reply), "\033P>|foot(%u.%u.%u%s%s)\033\\",
+ FOOT_MAJOR, FOOT_MINOR, FOOT_PATCH,
+ FOOT_EXTRA[0] != '\0' ? "-" : "", FOOT_EXTRA);
+ term_to_slave(term, reply, n);
+ break;
+ }
+
default:
UNHANDLED();
break;