9415 Commits

Author SHA1 Message Date
Mitchell Hashimoto
b44b1086d3 apprt/embedded: proper consumed modifier state for ctrl keys 2025-02-13 14:58:41 -08:00
Mitchell Hashimoto
9978ea3b9c Revert "macos: don't remove ctrl modifier for text input"
This reverts commit 3104b217581a9e580155216a260b1a79135b701a.
2025-02-13 14:20:13 -08:00
Mitchell Hashimoto
710ea1c8d9 up all the metadata to 1.1.2 2025-02-13 13:02:06 -08:00
Mitchell Hashimoto
ed60e07257 apprt: require envmap for exec-based termio (#5742)
Supercedes #5726
v1.1.1
2025-02-13 12:27:13 -08:00
Mitchell Hashimoto
1fea8028a3 apprt: require envmap for exec-based termio
Supercedes #5726
2025-02-13 12:26:11 -08:00
Mitchell Hashimoto
c481bdf704 macos: make goto_split, goto_tab, and move_tab performable (#5740)
Fixes #5552

This makes the mentioned actions performable. This isn't perfect, but it
does so in a way that resolves the user issue in #5552. This commit
returns an action is NOT performed if it doesn't have splits or tabs
(respectiely for the actions), but also reports its ALWAYS performed if
it does.

This latter logic isn't accurate: we should only return performable if
it was actually done. So for example, goto_split:top should do nothing
if we're already at the top. But, we report it as performed today.

This is good enough to resolve the issue and fix the core problem faced
for 1.1.0.
2025-02-13 10:59:04 -08:00
Mitchell Hashimoto
5105c52ef7 macos: make goto_split, goto_tab, and move_tab performable
Fixes #5552

This makes the mentioned actions performable. This isn't perfect, but it
does so in a way that resolves the user issue in #5552. This commit
returns an action is NOT performed if it doesn't have splits or tabs
(respectiely for the actions), but also reports its ALWAYS performed if
it does.

This latter logic isn't accurate: we should only return performable if
it was actually done. So for example, goto_split:top should do nothing
if we're already at the top. But, we report it as performed today.

This is good enough to resolve the issue and fix the core problem faced
for 1.1.0.
2025-02-13 10:40:07 -08:00
Mitchell Hashimoto
20dcae876d macos: don't remove ctrl modifier for text input (#5738)
Fixes #5448

We previously removed the ctrl modifier for text commit (IME-style) to
workaround a libghostty quirk (as noted in the comment in the diff). But
this broke other keyboard layouts.

This commit attempts to clean this up slightly -- but not completely --
by removing that hack, and only modifying the ctrl behavior for the
UCKeyTranslate call.

Long term, I plan to remove UCKeyTranslate completely, as noted in the
todo comment already written just below this diff.

This fixes the aforementioned issue and hopefully doesn't regress any
other behavior. I tested the following:

  1. Dvorak Ctrl characters
  2. Ergo-L Ctrl characters
  3. US standard Ctrl characters
  4. Japanese IME input Ctrl input to modify IME state
2025-02-13 09:51:26 -08:00
Mitchell Hashimoto
3104b21758 macos: don't remove ctrl modifier for text input
Fixes #5448

We previously removed the ctrl modifier for text commit (IME-style)
to workaround a libghostty quirk (as noted in the comment in the diff).
But this broke other keyboard layouts.

This commit attempts to clean this up slightly -- but not completely --
by removing that hack, and only modifying the ctrl behavior for the
UCKeyTranslate call.

Long term, I plan to remove UCKeyTranslate completely, as noted in the
todo comment already written just below this diff.

This fixes the aforementioned issue and hopefully doesn't regress any
other behavior. I tested the following:

  1. Dvorak Ctrl characters
  2. Ergo-L Ctrl characters
  3. US standard Ctrl characters
  4. Japanese IME input Ctrl input to modify IME state
2025-02-13 09:43:07 -08:00
Mitchell Hashimoto
15e41959eb Eliminate tab content flickering during tab movement on macOS (#5729)
Fixes https://github.com/ghostty-org/ghostty/issues/5689

The flickering was caused by uncontrolled visual updates during tab
reordering. The fix uses `NSAnimationContext` to batch all visual
changes together and simplifies window focus handling to prevent
unnecessary redraws.


https://github.com/user-attachments/assets/2a6525cd-8a97-418b-8442-18dab6b4636d
2025-02-13 09:24:41 -08:00
Mitchell Hashimoto
783f4014f8 build: replace codeberg dep with self-hosted mirror (#5736)
The content hashes match so if users don't trust us they can grab from
upstream.
2025-02-13 09:24:30 -08:00
Mitchell Hashimoto
2a29f71b2c draw octants directly rather than relying on font (#5433)
* implement `yQuads()` and `draw_octant()`, pretty obvious extensions of
existing code. to allocate up to 3 potential remainder lines, consider
that octants will often appear in a rectangular subset of the terminal.
we want the distributed excess uniformly distributed across such a
region. so:
* one excess row: break symmetry in any direction (pick an arbitrary
tetrad and use it everywhere)
  * two excess rows: go to alternating tetrads
* three excess rows: break symmetry, do not use three contiguous tetrads
* our `Octant`s are octary arrays of `bool`, provided as a somewhat
opaque constant table
* the 8-line copy-and-paste draw based on the `Octant` is not the
prettiest thing in the known universe
* we could generalize `draw_sextant()` and `draw_octant()` like
notcurses did, almost certainly
  * oh bird thou never wert
 

with that said, i don't think `draw_octant()` is actually being called
lol, so let's not merge this yet. happy to hear early feedback, though.
2025-02-13 09:21:11 -08:00
Mitchell Hashimoto
5919c57527 build: replace codeberg dep with self-hosted mirror
The content hashes match so if users don't trust us they can grab from
upstream.
2025-02-13 09:18:50 -08:00
nick black
8b2f9acfb4 Implement draw_octant() and yQuads() for U16.0 2025-02-13 09:08:33 -08:00
Mitchell Hashimoto
6f4716fd60 macOS: update additional references to Sparkle 2.6.3->2.6.4 (#5734) 2025-02-13 08:49:28 -08:00
Jeffrey C. Ollie
74f222abec macOS: update additional references to Sparkle 2.6.3->2.6.4 2025-02-13 10:35:38 -06:00
Jeffrey C. Ollie
9f6067d899 gtk: fix ui/blueprint builder (#5727)
fixes issues found while making use of the new builder api
2025-02-13 08:03:49 -06:00
Bryan Lee
f72fd32bf0 Eliminate tab content flickering during tab movement on macOS 2025-02-13 14:59:14 +08:00
Jeffrey C. Ollie
e396c8538a gtk: fix ui/blueprint builder 2025-02-12 22:16:33 -06:00
Jeffrey C. Ollie
432beac315 gtk: add support for using GTK Builder UI files and Blueprints (#5714)
Adds buildtime and comptime checks to make sure that Blueprints/UI files
are availble and correctly formed. Will also compile Blueprints to UI
files so that they are available to GTK code.
2025-02-12 19:10:50 -06:00
Mitchell Hashimoto
256281c5de terminal: reflow the saved cursor if we have one (#5720)
Fixes #5718

When a terminal is resized with text reflow (i.e. soft-wrapped text),
the cursor is generally reflowed with it.

For example, imagine a terminal window 5-columns wide and you type the
following without pressing enter. The cursor is on the X.

```
OOOOO
OOX
```

If you resize the window now to 8 or more columns, this happens, as
expected:

```
OOOOOOOX
```

As expected, the cursor remains on the "X". This behaves like any other
text input...

Terminals also provide an escape sequence to
[save the cursor (ESC 7 aka
DECSC)](https://ghostty.org/docs/vt/esc/decsc). This includes, amongst
other things, the cursor position. The cursor can be restored with
[DECRC](https://ghostty.org/docs/vt/esc/decrc).

The behavior of the position of the _saved cursor_ in the context of
text reflow is unspecified and varies wildly between terminals Ghostty
does this right now (as do many other terminals):

```
OOOOOOOO
   X
```

This commit changes the behavior so that we reflow the saved cursor.
2025-02-12 13:16:11 -08:00
Jeffrey C. Ollie
f63242f7fb gtk: add support for using GTK Builder UI files and Blueprints
Adds buildtime and comptime checks to make sure that Blueprints/UI files
are availble and correctly formed. Will also compile Blueprints to UI
files so that they are available to GTK code.
2025-02-12 15:05:42 -06:00
Mitchell Hashimoto
7dac9e02b3 terminal: reflow the saved cursor if we have one
Fixes #5718

When a terminal is resized with text reflow (i.e. soft-wrapped text), the cursor
is generally reflowed with it.

For example, imagine a terminal window 5-columns wide and you type the
following without pressing enter. The cursor is on the X.

```
OOOOO
OOX
```

If you resize the window now to 8 or more columns, this happens, as expected:

```
OOOOOOOX
```

As expected, the cursor remains on the "X". This behaves like any other text
input...

Terminals also provide an escape sequence to
[save the cursor (ESC 7 aka DECSC)](https://ghostty.org/docs/vt/esc/decsc).
This includes, amongst other things, the cursor position. The cursor can be
restored with [DECRC](https://ghostty.org/docs/vt/esc/decrc).

The behavior of the position of the _saved cursor_ in the context of text
reflow is unspecified and varies wildly between terminals Ghostty does this
right now (as do many other terminals):

```
OOOOOOOO
   X
```

This commit changes the behavior so that we reflow the saved cursor.
2025-02-12 10:34:31 -08:00
Jeffrey C. Ollie
99cbc06292 gtk: use the standard path for including Adwaita header file (#5716)
As pointed out by @tristan957 the standard path for including the
Adwaita header file is simply "adwaita.h". While it may have been
necessary in the past to use a non-standard include path, that no longer
appears to be the case.
2025-02-12 11:29:38 -06:00
Jeffrey C. Ollie
749bac3d72 gtk: use the standard path for including Adwaita header file
As pointed out by @tristan957 the standard path for including the
Adwaita header file is simply "adwaita.h". While it may have been
necessary in the past to use a non-standard include path, that no longer
appears to be the case.
2025-02-12 11:14:38 -06:00
Mitchell Hashimoto
1bb87e14a5 termio: free envmap when able, fix memory leak (#5715)
Caused by #5650

I actually don't understand how this didn't happen before or why we
didn't notice it but it seems like the envmap was never freed. In the
latest debug builds prior to this build GPA reports the leak.

We should free the envmap when the subprocess is deinitialized. But also
we can free the env map as soon as we start the subprocess which saves
some small amount of memory at runtime.

Additionally, we should only be freeing the envmap on error if we
created it.
2025-02-12 09:00:56 -08:00
Mitchell Hashimoto
9ea29dc508 termio: free envmap when able, fix memory leak
Caused by #5650

I actually don't understand how this didn't happen before or why we
didn't notice it but it seems like the envmap was never freed. In the
latest debug builds prior to this build GPA reports the leak.

We should free the envmap when the subprocess is deinitialized. But also
we can free the env map as soon as we start the subprocess which saves
some small amount of memory at runtime.

Additionally, we should only be freeing the envmap on error if we
created it.
2025-02-12 08:48:26 -08:00
Mitchell Hashimoto
f2f0c6b4e9 macOS: use Nix to get Zig deps (#5699)
This should help with API rate limits being hit by macOS builders since
they can't use the Namespace cache that Linux builders can use to cache
Zig dependencies. It will need to be run by Mitchell once so that the
Cachix action can push everything up to the cache and then the full
benefits should be seen. Not sure how using `--system` on all the macOS
builds will affect things overall but it doesn't seem to have affected
the CI.
2025-02-12 07:17:13 -08:00
Jeffrey C. Ollie
1e3cd89516 macOS: use Nix to get Zig deps 2025-02-12 08:21:16 -06:00
Mitchell Hashimoto
019f789819 macOS: fix iOS build breakage from #5644 (#5713) 2025-02-12 06:18:06 -08:00
Jeffrey C. Ollie
9bac6ecbff macOS: fix iOS build breakage from #5644 2025-02-12 07:54:50 -06:00
Leah Amelia Chen
76ab6717c9 gtk: fix context menu computed location (#5710)
When a tab bar is displayed, the context menu opened with right click is
offset from the cursor.

This was due to using the incorrect coordinate space for describing
where to draw the context menu.


[gtk_popover_set_pointing_to](https://docs.gtk.org/gtk4/method.Popover.set_pointing_to.html)
uses the coordinate space of the popover's parent, however we used the
active window's coordinate space which was noticeably different when the
tab bar is visible.

Before:
![Screenshot_12-Feb_22-39-07_com mitchellh
ghostty](https://github.com/user-attachments/assets/5263dd9d-f3ab-44f6-baf2-7208d3d3bd01)
After:
![Screenshot_12-Feb_22-41-41_com mitchellh
ghostty-debug](https://github.com/user-attachments/assets/8d3e8bbd-af4e-43a6-a52d-6601a0b66ece)
2025-02-12 13:08:33 +01:00
azhn
b1ae7eea2f gtk: fix context menu computed location 2025-02-12 22:46:00 +11:00
azhn
c061d06aa1 Revert "gtk: Point right-click context menu exactly at cursor to improve behaviour at edges and closeness to cursor"
This reverts commit bf5351ed416b12575d377fe0bd5628df515cb71e.
2025-02-12 19:50:32 +11:00
azhn
bf5351ed41 gtk: Point right-click context menu exactly at cursor to improve behaviour at edges and closeness to cursor 2025-02-12 19:02:56 +11:00
Mitchell Hashimoto
338a07ecad Performable tab and split navigation (#5644)
Partial fixes #5552 (for GTK).

This PR adds the core infrastructure for keybind actions that are
implemented as runtime app actions to be performable. This is done by
having `rt_app.performAction` return a boolean. By default all runtime
app actions return `true` (the action was performed) unless they are
modified to return `true`/`false` as appropriate.

The GTK apprt is modified so that `goto_split`, `previous_tab`,
`next_tab`, `last_tab`, and `goto_tab` are performable. macOS support
will need to be added in a subsequent commit.

This doesn't completely solve the issue for the OP because if the
`goto_split` isn't performable there is no fallback to`previous_tab` or
`next_tab`.

I don't think that the approach taken in #5579 is the right one as it
conflates split and tab navigation unconditionally which I don't think
is what everyone would want. Either a separate action that explicitly
combines the actions or a solution to #3175 will be the ultimate
solution I believe.
2025-02-11 17:03:39 -08:00
Mitchell Hashimoto
f26c96d51b apprt/glfw: return false for unimplemented actions 2025-02-11 16:53:04 -08:00
Mitchell Hashimoto
927cb4e622 apprt/gtk: some stylistic changes 2025-02-11 16:52:31 -08:00
Mitchell Hashimoto
cbf562ecb3 apprt/embedded: make performAction return the performable state 2025-02-11 16:43:50 -08:00
Jeffrey C. Ollie
69fd438370 gtk: make previous_tab, next_tab, last_tab, and goto_tab performable 2025-02-11 16:43:50 -08:00
Jeffrey C. Ollie
57e7565b7f gtk: make goto_split a performable action 2025-02-11 16:43:50 -08:00
Jeffrey C. Ollie
4ad749607a core: performAction now returns a bool
This is to facilitate the `performable:` prefix on keybinds that are
implemented using app runtime actions.
2025-02-11 16:43:50 -08:00
Mitchell Hashimoto
66442cd469 Refactor keybinding actions reference generation (#5695)
https://github.com/ghostty-org/ghostty/pull/4974#issuecomment-2652048815
2025-02-11 15:05:22 -08:00
Mitchell Hashimoto
afc42fe891 macos: add a variety of artist-drawn alternate icons (#5696)
This is just a fun change to add a bunch of alternate icons. We don't
want to add too many since this increases the final bundle size but we
also want to have some fun. :)


![Ghostty-More-Alts](https://github.com/user-attachments/assets/2bf228fb-7a1c-4341-a4a1-e9daca93d1c5)
2025-02-11 15:03:55 -08:00
Mitchell Hashimoto
58ab66f094 macos: add a variety of artist-drawn alternate icons
This is just a fun change to add a bunch of alternate icons. We don't
want to add too many since this increases the final bundle size but we
also want to have some fun. :)
2025-02-11 14:51:43 -08:00
Bryan Lee
1674224c1a Refactor keybinding actions reference generation 2025-02-12 06:29:40 +08:00
Mitchell Hashimoto
4aa452a2c7 gtk(x11): set WINDOWID env var for subprocesses (#5650)
`WINDOWID` is the conventional environment variable for scripts that
want to know the X11 window ID of the terminal, so that it may call
tools like `xprop` or `xdotool`. We already know the window ID for
window protocol handling, so we might as well throw this in for
convenience.

Originally suggested by #4299
2025-02-11 13:55:30 -08:00
Leah Amelia Chen
56ea6c406c gtk(x11): set WINDOWID env var for subprocesses
`WINDOWID` is the conventional environment variable for scripts that
want to know the X11 window ID of the terminal, so that it may call
tools like `xprop` or `xdotool`. We already know the window ID for
window protocol handling, so we might as well throw this in for
convenience.
2025-02-11 13:42:12 -08:00
Mitchell Hashimoto
f8b547f92e Revert "Fixed documentation generation in list-actions --docs command (#4974)"
This reverts commit f3d0c7c2ad01968de5191ccfae09a25e5c760760, reversing
changes made to 4b77a1c71e7994f6c040c4bee8a9e0b3d77b6286.
2025-02-11 12:55:40 -08:00
Mitchell Hashimoto
adb187685b Fix confirm-close-surface not working for hidden quick terminal (#5647)
Fixes #5450.


https://github.com/user-attachments/assets/7090fe55-dd1f-4517-9f8a-ffc3807283db
2025-02-11 12:55:20 -08:00