Summary
foot now has its entire terminfo builtin, and will respond to XTGETTCAP queries for all capabilities, including the XTGETTCAP specific TN, Co and RGB ones.
For reference, XTerm only sends replies for keyboard escapes (i.e. k* capabilities). Kitty sends replies for everything (as far as I can tell), except for boolean capabilities.
Details
We emit one DCS reply for each queried capability (like Kitty, but unlike XTerm), as this allows us to a) not skip any capabilities in the query, and b) reply with correct success/fail flag for each capability.
Similar to Kitty (but again, unlike XTerm), we support quering all terminfo capabilities. In unparameterized capabilities, \E is "expanded" to a literal ESC, while in parameterized capabilities, \E is kept as-is (this is identical to Kitty's behavior).
We do not batch the entire reply - as soon as the reply for one capability is done, we write it to the PTY.
(削除) In this iteration, boolean capabilities are not supported. Not even Kitty supports this. (削除ここまで)
We now reply with DCS 1 + r <capability> ST for boolean capabilities. That is, a normal "success" reply, minus the = <value> part. Note that foot is the only terminal emulator I'm aware of that does this. Kitty does not respond with any boolean capabilities.
Closes #846
https://codeberg.org/attachments/f4834e44-9967-4816-96e8-20c473630504
Image shows a mix of boolean, integer and string capabilities being queried, as well as one invalid capability.
Size
~(削除) This adds 20K to the final binary size. In the variant currently used here (const char * for each capability/value pair), each capability uses 16 bytes (two 8-byte pointers), plus the size of the actual strings. However, this results in lots of relocations, which increases the binary size further. (削除ここまで)
~(削除) If we instead use a table with fixed-sized char arrays (allowing for the longest capability names/values), then we lose the relocations, but the table itself becomes 20K. (削除ここまで)
The internal representation has been changed, from a table, to a single NULL-separated char array. This drops all extra pointers, and all extra relocations. The array itself is ~3.3K - much better than the 20K we saw before.
# Summary
foot now has its entire terminfo builtin, and will respond to `XTGETTCAP` queries for **all** capabilities, including the `XTGETTCAP` specific `TN`, `Co` and `RGB` ones.
For reference, XTerm only sends replies for keyboard escapes (i.e. `k*` capabilities). Kitty sends replies for everything (as far as I can tell), except for boolean capabilities.
# Details
We emit one DCS reply for each queried capability (like Kitty, but unlike XTerm), as this allows us to **a)** not skip any capabilities in the query, and **b)** reply with correct success/fail flag for each capability.
Similar to Kitty (but again, unlike XTerm), we support quering **all** terminfo capabilities. In unparameterized capabilities, `\E` is "expanded" to a literal ESC, while in parameterized capabilities, `\E` is kept as-is (this is identical to Kitty's behavior).
We do not batch the entire reply - as soon as the reply for _one_ capability is done, we write it to the PTY.
~~In this iteration, boolean capabilities are not supported. Not even Kitty supports this.~~
We now reply with `DCS 1 + r <capability> ST` for boolean capabilities. That is, a normal "success" reply, minus the `= <value>` part. Note that foot is the only terminal emulator I'm aware of that does this. Kitty does not respond with any boolean capabilities.
Closes #846

Image shows a mix of boolean, integer and string capabilities being queried, as well as one invalid capability.
# Size
~~This adds ~20K to the final binary size. In the variant currently used here (`const char *` for each capability/value pair), each capability uses 16 bytes (two 8-byte pointers), plus the size of the actual strings. However, this results in lots of relocations, which increases the binary size further.~~
~~If we instead use a table with fixed-sized char arrays (allowing for the longest capability names/values), then we lose the relocations, but the table itself becomes ~20K.~~
The internal representation has been changed, from a table, to a single NULL-separated char array. This drops all extra pointers, and all extra relocations. The array itself is ~3.3K - much better than the 20K we saw before.