The clear_screen binding does nothing on the alternate screen already,
but we were still marking the action as "performed" which caused the
binding to be consumed.
This meant that alt screen applications like neovim, tmux, etc. couldn't
see "cmd+k" (default binding for clear_screen on macOS) without the
Ghostty user unbinding it completely.
We already have other bindings that do not consume only when they do not
perform, such as `previous_tab` and `next_tab`. This extends the
framework we built for that to this action.
Following up on #1145, this changes middle-click behavior on MacOS to
always paste from the system clipboard. This does not alter any of the
selection behavior, i.e. default behavior is to allow paste, but you
still need to manually copy. MacOS users still need to enable
"copy-on-select = clipboard" for that respective functionality.
Fixes#1052
This implements a `close_all_windows` binding in the core and implements
it for macOS specifically. This will ask for close confirmation if any
surface in any of the windows requires confirmation.
This is bound by default to option+shift+command+w to match Safari. The
binding is generall option+command+w but users may expect this to also
mean "Close All Other Tabs" which is the changed behavior if any tabs
are present in a standard macOS application. So I chose to follow Safari
instead.
This doesn't implement this feature for GTK, that's left as an exercise
for a contributor.
This fixes keyToMouseShape (the new handler for mouse shape state for
key combinations, e.g. during mouse tracking override or rectangle
select) so that it respects whether or not the mouse is currently
hidden, and will not send back a shape to change the mouse to in these
situations.
Fixes#1107.
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.
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.
This fixes an issue where selections from the bottom-right to the
top-left (or top-left to bottom-right), in addition to some single-line
rectangle selections, were not working.
This works by handling situations where only one of the x or y
axes in the start or end points may need to be flipped to get the
correct top-left or bottom-right of a selection. We call these kinds of
orientations "mirrored", like you were looking in a mirror.
This also adds a small bit of logic that keeps these kinds of motions in
rectangle selection from selecting the character before or after it.
This has the current side-effect of anchoring a rectangle selection to
the original characters if you change directions during the selection,
something I will look at in a later commit.
Finally, this also removes rectangle select on double-click. I thought
this might be a good idea, but word select in rectangle mode really
does not work (the effect seems pretty erratic), and it's not
implemented in Kitty either.
Fixes#1008.
Fixes#965
When processing keybindings that closed the surface (`close_surface`,
`close_window`), the surface and associated runtime structures would be
freed so we could segfault.
This PR introduces a new enum result for input events (only key for now)
that returns whether an event resulted in a close. In this case, callers
can properly return immediately and avoid writing to deallocated memory.
Fixes#991
This changes the default embedded font from Fira to JetBrains Mono. This
only affects users who don't specify or font AND Ghostty can't find
another default font to use on their system.
This is one part an aesthetic choice: I've grown to personally like
JetBrains Mono more than Fira, and I think I have the right to change
the defaults ;)
But this is also partly because of #991: FiraCode contains glyphs for
symbolic ranges. This may not be Fira official... I think I may have
used a Nerd font patched one and that may be the issue. So I don't want
to blame the Fira font project. BUT, we have to replace the ttf in our
project and since I've been meaning to switch to JB Mono I just did that
now.
Fixes#882
We previously had a hardcoded limit of 16 codepoints. In #882, a user
pointed out that in Chinese, is reasonable for a preedit input to be
longer than this.
To avoid any future issues, this commit moves to a heap-allocated
variant. Preedits aren't that common, they aren't high throughput, and
they're generally pretty small, so using a heap allocation is fine. The
memory is owned by the person who set it.
If mouse events are active and the cursor is hovered over a link,
pressing Shift does not change the cursor to a pointer, but to the text
selection shape, until the cursor is moved again. The pointer shape
should have higher priority over the text selection shape when the
cursor is hovered over a pointer.
This adds rectangle select mode; when dragging with ctrl+alt (or
super+alt on MacOS), this allows you to select a rectangular region of
the terminal instead of the full start-end points of the buffer.