This is a weird one. By using intCast on the `idx` I am periodically
getting a panic on index out of bounds where the index is larger than
FontIndex can possibly be. Very strange!
I tried to just remove intCasts and believe it or not that worked.
Previously, `cat /dev/urandom` would trigger the issue in seconds and
now I've had it running 20+ minutes without the issue.
The additional `if` check is just a safety mechanism
Fixes#362
We previously tried to parse 4-form 48, but as far as I can tell this is
never used anyways and in this real world scenario it expected us to
parse a 3-form followed by an underline. This fixes the real world
scenario as priority and adds a test.
This also fixes an issue where single form colon underline may actually
exist, again from a real world scenario.
Fixes#359
See #359 for a test script. The unit tests were also wrong. I used the
test script in #359 to verify the exact column that tabstops should be
set at.
Fixes#143
There were multiple issues with the previous calculation. First, we
expected dash width COULD be negative and protected against it, but our
dash width calculation type was unsigned! With the proper font metrics,
this led to an underflow safey panic.
Second, as part of the dash width calculation, we are tryign to downstep
the size of the gaps so we can try to fit dashes within a cell. But we
were not using those adjusted gap sizes. With the proper font metrics,
this could lead to an assertion failure seen in #143.
This fixes the calculations. They produce the same numbers, but do so in
a more Zig-idiomatic way while fixing the above two issues.
WezTerm claims this is an emerging de-facto standard for terminal emulator identification:
a103b6d97a/config/src/config.rs (L1526-L1529)
One example of usage in the wild is neovim doing capability detection:
f050aaabbb/src/nvim/tui/tui.c (L206-L211)
Ghostty now reports this:
$echo $TERM_PROGRAM
ghostty
$echo $TERM_PROGRAM_VERSION
0.1.0-main+aa08f3c
I think it's really nice that the commit hash is included, as users can provide this in issue reports. WezTerm does the same.
I use these variables in my tui library in addition to $TERM and $COLORTERM for capability detection, which is what motivated this PR.