mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
dcs: xtgettcap: handle boolean capabilities
Reply with DCS 1 + r <cap> ST
This commit is contained in:
parent
7feab6092c
commit
44aad0941f
2 changed files with 13 additions and 4 deletions
8
dcs.c
8
dcs.c
|
|
@ -99,6 +99,14 @@ xtgettcap_reply(struct terminal *term, const char *hex_cap_name, size_t len)
|
|||
if (entry == NULL)
|
||||
goto err;
|
||||
|
||||
if (entry->value == NULL) {
|
||||
/* Boolean */
|
||||
term_to_slave(term, "\033P1+r", 5);
|
||||
term_to_slave(term, hex_cap_name, len);
|
||||
term_to_slave(term, "\033\\", 2);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reply format:
|
||||
* \EP 1 + r cap=value \E\\
|
||||
|
|
|
|||
|
|
@ -174,9 +174,6 @@ def main():
|
|||
'static const struct foot_terminfo_entry terminfo_capabilities[] = {\n')
|
||||
|
||||
for cap in sorted(entry.caps.values()):
|
||||
if isinstance(cap, BoolCapability):
|
||||
continue
|
||||
|
||||
name = cap.name
|
||||
value = str(cap.value)
|
||||
|
||||
|
|
@ -194,7 +191,11 @@ def main():
|
|||
# Do escape ‘“‘
|
||||
name = name.replace('"', '\"')
|
||||
value = value.replace('"', '\"')
|
||||
target.write(f' {{"{name}", "{value}"}},\n')
|
||||
|
||||
if isinstance(cap, BoolCapability):
|
||||
target.write(f' {{"{name}", NULL}},\n')
|
||||
else:
|
||||
target.write(f' {{"{name}", "{value}"}},\n')
|
||||
|
||||
target.write('};\n')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue