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
This commit is contained in:
Daniel Eklöf 2021-02-16 12:00:58 +01:00
parent efd023ad32
commit 3adc3367e6
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 19 additions and 0 deletions

View file

@ -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

16
csi.c
View file

@ -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;