Fixes#521
We were not initializing the dead key state. The dead key state is read
on all translation calls so it must be initialized to 0. This was
working before because coincidentally whatever the memory was always
worked (it probably didn't, but it never didn't work for someone to
notice).
In debug modes, Zig sets uninitialized memory to 0xAAAAAAAA. Amusingly,
this is a valid dead key state value that UCKeyTranslate ignores and
thus produces the correct value. Therefore, we were only seeing bugs in
release modes where the uninitialized memory was a bad value
(consistently 0x1 on my machine) causing the wrong key to come out.
We were getting lucky before, this has always been a bug.
Add a terminfo entry for Smulx, which advertises support for curly,
dashed, dotted, etc underlines
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Without this, non-first-responder views would not receive mouse
entered/exit events. This would break some of our mouse hiding state.
See comments for more info.
The osc_string state of the parser limited accepted bytes to 0x7F. When
parsing a utf-8 encoded string as part of an OSC string, the parser
would encounter an error and abort the OSC parsing, allowing any
remaining bytes to be leaked (possibly) as printable characters to the
terminal window.
Allow any byte in the range 0x20 - 0xFF to be accepted by osc_put. Add
test cases which conflict with the 'anywhere' transitions (IE the utf8
sequence includes C1 control codes which might transition to another
state).
Commit fbe030d85a80 ("terminal: respond to XTVERSION query") introduced
responding to XTVERSION queries. The implementation uses the
.write_small method, which has a limit of 38 bytes. This works well if
your branch is named "main", since the branch is part of the
version_string variable. If you start using longer branch names, you can
quickly run into the limit.
The XTVERSION response is:
"\x1bP>|ghostty d.d.d-<branch>+<12-digit-hash>\x07"
Which has an overhead of 32 bytes, meaning the natural branch limit is 6
bytes (6 characters, assuming you use ASCII branch names). Github has a
limit of 256 chars, so let's set a max XTVERSION buffer of 256+32 = 288
Fixes: fbe030d85a80 ("terminal: respond to XTVERSION query")
XTVERSION (CSI > 0 q) is used by some libraries to identify the terminal
+ version. Respond to this query with `ghostty {version_string}`. There
is no formal format for this response. A roundup of a few tested
terminals show two primary formats. This patch opts to save one byte and
use the `name SP version` semantics.
foot: foot(version)
xterm: XTerm(version)
contour: contour version
wezterm: wezterm version
Reference: https://github.com/dankamongmen/notcurses/blob/master/TERMINALS.md#notes-for-terminal-authors
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>