mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
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
This commit is contained in:
parent
cc60d3a670
commit
60984e7a24
3 changed files with 31 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
18
csi.c
18
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':
|
||||
|
|
|
|||
|
|
@ -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}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue