Related to #1102, #1074
Because we are now using the built-in zsh on macOS to launch the real
shell the user wants to use (see #1102 for why), this "outer zsh"
process was consuming our shell integration setup.
This commit adds flags so that this zsh instance doesn't load local
zshrc files and therefore doesn't consume our shell integration setup.
This work is mainly targeted at adding the crosshair for when
ctrl/super+alt is pressed. We also add this for when mouse tracking is
enabled so that we show the crosshair when ctrl/super+alt+shift is
pressed at the same time.
I've also changed the event processing logic here because the amount of
keys we have to process has greatly increased. Instead of processing
each individual event, we now process the modifier state.
Additionally, some refactoring has been done geared at starting to
re-work the mouse for the core surface into a something stateful. My
hope is that we can continue to unravel some of this from the core
surface so that we can process key inputs, motion events, and anything
else relevant as inputs to transitions for shape display, click
behavior, etc.
This commit now also moves the ctrlOrSuper handlers to respective parts
in the Key hierarchy, while also adding additional helpers for other
modifiers.
Fixes#1101
GTK forces all GLArea drawing to happen on the GUI thread. In this
scenario, `updateFrame` and `drawFrame` could be happening in parallel.
This commit grabs the lock while updating the Kitty image protocol state
since that is used by both functions.
We already have a mutex called "draw_mutex" that we hold while we're
modifying data that could be shared by this separate draw thread. We
should reuse that here.
This uses separate strings for the keys for the conformance tests versus
just deriving them from the sliced path.
This fixed an issue for me where a few of the tests were showing up as
InvalidConformance (notably the "blocks" test), even though, oddly
enough, the key/value entries do appear to be there (e.g. if you iterated
over them). I did notice, though, that we currently sliced the key from
the file entry of the directory iterator, which is closed at the end of
conformanceSteps.
Only SGR, DECSCUSR, DECSTBM, and DECSLRM are handled, as these are the
only ones that Ghostty supports (as far as I can tell) and are the only
ones that seem actually useful.
Related to https://github.com/mitchellh/ghostty/issues/1082
This fixes two separate issues to follow along with the new spec changes
Kovid pushed to Kitty:
1. When two modifiers are pressed and one is released, this shows up
as a proper release event with the correct side. Previously, the
correct side was shown but as a press event.
2. When two modifiers are pressed and one is released, the Kitty event
should not have that specific modifier set. For example, pressing
left ctrl, then right ctrl, then releasing right ctrl should encode
as "right ctrl released" but with NO modifiers still present.
Some control key combinations must be handled specially by Ghostty to
prevent undesirable behavior at the OS level. For now, this includes
only Ctrl-/, which makes a "beep" sound when processed by AppKit. It is
unclear why this beep occurs and no answer was found after extensive
searching.
This solution is inspired by iTerm2, which also handles certain control
key combinations (including C-/) manually before passing them on to
Cocoa/AppKit.
This fixes a couple of subtle rectangle select behaviors:
* Corrects how selection rolls over when crossing the x-boundary; this
was mentioned in #1021, this properly corrects it so both sides of the
x-boundary do not share characters.
* Corrects a minor quirk in the selection of initial cells in a
selection - this can be more readily observed when selecting a single
line with rectangle select. To correct this, we only use the x axis
when calculating this instead of both x and y.
Some box codepoints (the cursor) want to use the original font metrics
height but others (corners) want to use the full grid height. I can't
see a better way to do this than manually maintaining a switch here. We
can add codepoints as needed.
Add additional keypad keys to the encoding scheme. This allows Ghostty
to report KP_HOME and it's relatives. We also always check for a keyval
first, so we can report KP_7, etc as opposed to ASCII '7'.
GTK doesn't expose the num_lock state via the key press event, this must
be obtained directly from the device. Set the num_lock state in the
modifier mask. This also will never show up as a `consumed_mod`, so we
don't bother setting it there.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>