diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-07-24 15:47:47 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-07-24 15:47:47 +0000 |
| commit | 60984e7a2476e81ffe9d356d6e4cb11e218d812e (patch) | |
| tree | 6a821f316b022c5f6cac9129c9c86a82ea00dd5a | |
| parent | csi: 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
| -rw-r--r-- | CHANGELOG.md | 7 | ||||
| -rw-r--r-- | csi.c | 18 | ||||
| -rwxr-xr-x | generate-version.sh | 9 |
3 files changed, 31 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index be481757..2d2138b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,13 @@ * Primary DA to no longer indicate support for _Selective Erase_, _Technical Characters_ and _Terminal State Interrogation_. +* Secondary DA to report foot as a VT220 instead of a VT420. +* Secondary DA to report foot's version number in parameter 2, the + _Firmware Version_. The string is made up of foot's major, minor and + patch version numbers, always using two digits for each version + number and without any other separating characters. Thus, _1.4.2_ + would be reported as `010402` (i.e. the full response would be + `\E[>1;010402;0c`). ### Deprecated ### Removed ### Fixed @@ -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': diff --git a/generate-version.sh b/generate-version.sh index ecd0306f..cfb85059 100755 --- a/generate-version.sh +++ b/generate-version.sh @@ -22,7 +22,14 @@ else new_version="${default_version}" fi -new_version="#define FOOT_VERSION \"${new_version}\"" +major=$(echo "${new_version}" | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1/') +minor=$(echo "${new_version}" | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\2/') +patch=$(echo "${new_version}" | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\3/') + +new_version="#define FOOT_VERSION \"${new_version}\" +#define FOOT_MAJOR ${major} +#define FOOT_MINOR ${minor} +#define FOOT_PATCH ${patch}" if [ -f "${out_file}" ]; then old_version=$(cat "${out_file}") |
