531 Commits

Author SHA1 Message Date
Mitchell Hashimoto
e95b1707c1 core: fallback to heap allocation for long preedit inputs
Fixes #1514

We previously required all preedit inputs to fit into the small copied
message size. That's true for 99% of all inputs, but if a long pre-edit
input comes in, this may not be true. We should try the small array
fast-path but fall back to heap allocation if we must.
2024-02-12 21:21:35 -08:00
Mitchell Hashimoto
be0595d71d apprt/embedded: add occlusion state callback 2024-02-12 13:48:09 -08:00
Erlend Lind Madsen
928d338c2b preeditCallback(self): remove fast path codepoint width 2024-02-09 21:44:54 +01:00
Erlend Lind Madsen
cf0d498e75 replace ziglyph codePointWidth -> table.get 2024-02-09 20:04:51 +01:00
Mitchell Hashimoto
f414787779 move SplitDirection to apprt 2024-02-04 20:42:42 -08:00
Tim Culverhouse
1824a0fe87 split: add auto as split option
Add an `auto` split direction which splits along the larger direction.
2024-02-04 21:28:17 -06:00
Krzysztof Wolicki
3959364a86 Surface: fix reportColorScheme on Windows 2024-02-03 13:08:05 +01:00
Mitchell Hashimoto
6fe8376073 terminal: support mode 2031 2024-02-02 13:08:10 -08:00
Mitchell Hashimoto
258d51395c apprt/embedded: add API for reporting color scheme 2024-02-02 13:02:16 -08:00
Mitchell Hashimoto
ae8f5f3ceb core: colorSchemeCallback on surface, can report 2024-02-02 12:51:20 -08:00
Mitchell Hashimoto
88e7c96eac Merge pull request #1431 from mitchellh/mouse-mods-alt
core: handle mouse capture events with link highlighting
2024-02-01 09:20:04 -08:00
Mitchell Hashimoto
6de4533afb core: handle mouse capture events with link highlighting
Fixes #1416

At a high level, the issue is that when mouse capture is enabled (i.e. in
neovim), "shift" escapes the capture. So "cmd+shift" is equal to "cmd"
which doesn't get sent to the TUI program and so on. For link
highlighting which now requires "cmd" (super) is held, we were sending
"cmd+shift" to the renderer so we weren't checking for links.

So the core of this commit is respecting this scenario and stripping the
shift modifier.

This commit also found that when the mouse wasn't over a link, we were
always checking and highlighting links on line one of the visible
screen. This bug is fixed and should also result in a very slight
performance improvement on rendering in all cases.
2024-02-01 09:19:39 -08:00
Mitchell Hashimoto
eafc9559d7 core: add "reset" keybinding to reset the terminal
Fixes #1425
2024-02-01 08:46:39 -08:00
Mitchell Hashimoto
0e46783a5d Merge pull request #1388 from mitchellh/macos-mods
core: send key release events on focus loss
2024-01-28 13:51:29 -08:00
Mitchell Hashimoto
06ff385e0c Merge pull request #1394 from em-dash/configure-scroll-speed
Configure scroll speed  #1378
2024-01-27 21:24:05 -08:00
Mitchell Hashimoto
5095c8f477 core: be explicit about float rounding for mouse scroll multiplier 2024-01-27 21:14:42 -08:00
Mitchell Hashimoto
3efe88c85c input: add link highlight always/hover w/ mods 2024-01-27 19:07:49 -08:00
Mitchell Hashimoto
ae11cc9042 add a new highlight state that requires modifiers 2024-01-27 19:03:03 -08:00
em-dash
ce7ba52b12 Add mouse-scroll-multiplier config option 2024-01-28 11:08:41 +11:00
Mitchell Hashimoto
1f4c8f3aa5 core: send key release events on focus loss
Related to #1284

This is highly GUI toolkit specific, but it is impossible to receive
events for some key releases when focus is lost while the keys are still
behind held. This commit always sends a release event for the last
pressed key when focus is lost, including each individual modifier.

On macOS, AppKit sends a key release event to a view if a prior press
event was sent, but only for non-modifier keys. This means that with
this commit (1) the full key release event is repeated but (2) modifier
release events are now properly sent.

On Linux with GTK, GTK sends modifier release events but not key release
events. This means that the behavior is inverted from macOS!

The result of this commit is that key release events _may be repeated_
on focus loss, but it ensures that all prior key+modifiers for the most
recent press event are released. This will require that TUI apps
handling release apps are idempotent in their release handling but I
don't think thats unrealistic to expect and I've already been able to
demonstrate at least Kitty sending duplicate release events in some
scenarios so this seems like a safe assumption.
2024-01-27 07:49:04 -08:00
Matt Robenolt
e70ec5d5f4 Only detect links when Super is held down
This stops underlining and changing to a pointer unless Cmd or Ctrl is
held down already.
2024-01-26 20:52:00 -08:00
Matt Robenolt
6c6b42d40c Open links with Super+click
A few people, including myself, many times accidentally click links by
either clicking around aimlessly or getting focus back to Ghostty that
happens to be hovering over a link.

In iTerm2, if you want links enabled, it's always Cmd+Click.
2024-01-26 20:23:40 -08:00
Mitchell Hashimoto
2c924be9b1 core: only dump scrollback contents if there is scrollback
Fixes #1353
2024-01-21 20:55:41 -08:00
Mitchell Hashimoto
4dbd10c913 apprt/embedded: support asking for selection text, existence 2024-01-21 17:22:44 -08:00
Mitchell Hashimoto
344c2db097 renderer/metal: initialize layer in init, handle iOS layer 2024-01-18 18:51:01 -08:00
Mitchell Hashimoto
5fe3900efa core: Apple Emoji should be loaded on any darwin, not just macos
It is available on iOS too.
2024-01-18 15:02:32 -08:00
Mitchell Hashimoto
0277a0fb4c renderer/metal: detect frame commit failures and notify surface 2024-01-16 10:51:36 -08:00
Mitchell Hashimoto
adb7958f61 remove tracy usage from all files 2024-01-13 15:06:08 -08:00
Mitchell Hashimoto
50a119d300 Selection: add adjust method, unit test it, swap for adjustments 2024-01-11 22:14:40 -08:00
Qwerasd
3f3703deb6 Fixed accidentally consuming ALL shift+<key> releases 😅 2024-01-11 21:58:19 -05:00
Qwerasd
8cf3b6bef3 Shift+keys selection: Fixed up/down logic, added page up/down, home, & end. 2024-01-11 21:19:41 -05:00
Qwerasd
e0867801a5 Added use of shift+arrow keys to expand current selection 2024-01-11 20:58:12 -05:00
Mitchell Hashimoto
cba27e26cf input: manage application keypad state with mode 1035
Fixes #1099

We previously applied application keypad mode logic (`ESC=` or mode 66)
whenever it was active. However, from looking at the behavior of other
terminals (xterm and foot) it appears this isn't correct.

For xterm, application keypad mode only applies unconditionally if the
keyboard mode is VT220 (`-kt vt220`). For modern terminals, application
keypad mode is only applied if mode 1035 is disabled.

Mode 1035 is the "ignore numpad state with keypad mode" mode. It
defaults to true on terminal startup. If this is true, keypads are
always encoded in numerical mode. If this is false, the numlock state
will be respected.
2024-01-09 11:57:09 -08:00
Mitchell Hashimoto
96d33fef20 custom shader animation can be set to "always" to always remain active
Fixes #1225

The `custom-shader-animation` configuration can now be set to "always"
which keeps animation active even if the terminal is unfocused.
2024-01-09 09:21:15 -08:00
Mitchell Hashimoto
bc80073ffd core: add emoji fallback on macOS after built-in font
This doesn't fix any issues, but it slightly improves performance since
we'll try our text font first which is most likely to hit most input.
2024-01-08 08:01:17 -08:00
Mitchell Hashimoto
383b7c5870 core: clear_screen binding doesn't consume on alt screen
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.
2024-01-07 07:54:42 -08:00
Mitchell Hashimoto
962be81f71 core: add Apple Color Emoji on macOS if its available 2024-01-05 21:03:37 -08:00
Mitchell Hashimoto
b4f403f152 font-family settings are repeatable to specify fallback 2024-01-03 09:30:12 -08:00
Chris Marchesi
ffb9ebf6d9 macos: middle click always pastes from clipboard
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.
2023-12-22 17:51:51 -08:00
Mitchell Hashimoto
900b127a04 core: cursor click to move can be disabled 2023-12-20 22:12:04 -08:00
Mitchell Hashimoto
3776b8a777 core: if click-to-move is done, stop mouse processing 2023-12-20 21:41:49 -08:00
Mitchell Hashimoto
3f9c42fd67 core: fast path out of click to move if no semantic prompts 2023-12-20 21:40:02 -08:00
Mitchell Hashimoto
82e5080cd6 core: click to move cursor only works on primary screen 2023-12-20 21:38:21 -08:00
Mitchell Hashimoto
4a3e1e15e5 core: click to move cursor 2023-12-20 21:33:13 -08:00
Mitchell Hashimoto
9c0de96c79 Merge pull request #1116 from clebs/feature/settings-shortcut
macos: Add settings shortcut
2023-12-18 08:08:48 -08:00
Mitchell Hashimoto
97433d3aa1 macos: close all windows
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.
2023-12-17 20:54:57 -08:00
Borja Clemente
646e3c365c Add settings shortcut on MacOS
- Settings shortcut opens the config file in the default editor.

Signed-off-by: Borja Clemente <borja.clemente@gmail.com>
2023-12-17 16:19:22 +01:00
Chris Marchesi
a6aad756e5 Surface: ensure keyToMouseShape respects hidden state
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.
2023-12-16 22:29:01 -08:00
Chris Marchesi
6e8ed4e8b3 Surface: set crosshair, change event processing logic for mouse tracking
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.
2023-12-15 19:23:10 -08:00
Chris Marchesi
aeaf5ea467 Surface: fix some rectangle select behaviors
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.
2023-12-13 10:51:17 -08:00