11333 Commits

Author SHA1 Message Date
Jayson Reis
d5995ac45c build-system: Replace deprecated usages of root_source_file on addTests 2025-07-23 00:03:44 +02:00
Mitchell Hashimoto
49cf8d80a6 core: use std.testing.expectEqualStrings where appropriate (#8025) 2025-07-22 13:40:25 -07:00
Jeffrey C. Ollie
cc0a688b5d core: use std.testing.expectEqualStrings where appropriate 2025-07-22 13:08:24 -05:00
Leah Amelia Chen
7eab97653d terminal/osc: allow empty payloads (#8023) 2025-07-23 02:57:04 +09:00
Leah Amelia Chen
c194f7a0cd i18n(zh_CN): update strings 2025-07-22 17:38:49 +00:00
Leah Amelia Chen
a01a40394a i18n: update translations 2025-07-22 17:25:57 +00:00
Leah Amelia Chen
a7b7c10474 gtk: only show clipboard toast when content isn't empty 2025-07-22 17:25:57 +00:00
Leah Amelia Chen
d3f40d70e2 terminal/osc: allow empty payloads
xterm docs explicitly say that empty payloads should be permitted and
are used to clear the selected clipboards, so we need to implement that
correctly. The GTK apprt still shows a "Copied to Clipboard" toast though
and we might want to change that too
2025-07-22 16:50:29 +00:00
Mitchell Hashimoto
820879d2ef apprt/gtk-ng: port surface cgroup logic (#8013)
Absolutely nothing interesting here, just porting our cgroup logic.
2025-07-21 21:24:41 -07:00
Mitchell Hashimoto
8f8f2ebd2d apprt/gtk-ng: surfaces start in cgroup if enabled 2025-07-21 21:21:09 -07:00
Mitchell Hashimoto
578fd7f7f8 apprt/gtk-ng: resize overlay (#8012)
This implements the resize overlay. This is implemented using a new
mostly generic `ResizeOverlay` class that can probably be renamed one
day to something like `TemporaryOverlay` since it is generic to show a
label with a duration.

The only user-facing change here is `after-first` behavior has been
changed in the config to actually mean "after a delay." The
`after-first` behavior has been problematic since we introduced it on
both macOS and Linux because a lot of windowing systems may perform
multiple resizes very quickly at startup (especially tiling ones) so its
less about being "first" and more about semantically only showing the
overlay for user-driven resizes. We should rename this, eventually.

The valgrind suppression file change is mostly to handle an alternate
machine, but its all the same stuff (GTK renderers, GPU drivers, etc.),
nothing new in our app code.
2025-07-21 21:05:14 -07:00
Mitchell Hashimoto
4aaacc04a5 fix logger name 2025-07-21 20:54:16 -07:00
Mitchell Hashimoto
6abb9ec427 ignore valgrind supp file for typos 2025-07-21 20:51:58 -07:00
Mitchell Hashimoto
66ce764d67 valgring supps for VMware VGA 2025-07-21 20:49:08 -07:00
Mitchell Hashimoto
9caf5f5a86 apprt/gtk-ng: ResizeOverlay class 2025-07-21 20:48:59 -07:00
Mitchell Hashimoto
c6abf65dd1 apprt/gtk-ng: resize overlay 2025-07-21 14:02:16 -07:00
Mitchell Hashimoto
e34248a2ad apprt/gtk-ng: hovered url overlay (#8010)
I was going to do more overlays but this introduced enough new
complexity that I want to PR this on its own.

Valgrind clean!
2025-07-21 14:02:10 -07:00
Mitchell Hashimoto
58ccfb558a apprt/gtk-ng: mouse over link to show tooltip 2025-07-21 12:56:03 -07:00
Mitchell Hashimoto
7711f6b5b6 apprt/gtk-ng: setup basic css resources 2025-07-21 09:58:46 -07:00
Mitchell Hashimoto
55a384e165 apprt/gtk-ng: implement quit timer, close app confirmation (#8006)
This PR tidies up our quit logic to match the GTK implementation,
respecting quit delays and also showing a confirmation dialog if
required. There shouldn't be anything surprising here, its mostly a
copy/paste of the old logic with very small tweaks to fit the new style.
2025-07-21 09:32:21 -07:00
Mitchell Hashimoto
2333815b6c apprt/gtk-ng: implement app close confirmation dialog 2025-07-21 09:06:10 -07:00
Mitchell Hashimoto
ab8717e320 apprt/gtk-ng: hook up basic quit functionality (no confirm) 2025-07-21 08:36:08 -07:00
Mitchell Hashimoto
3e83364937 apprt/gtk-ng: hook up quit timer 2025-07-21 08:36:08 -07:00
Mitchell Hashimoto
805c8601a9 apprt/gtk-ng: hook up title, pwd surface properties (#8005)
Continuing to plumb along the APIs necessary basic surface functionality
before moving onto windowing functionality. This adds title/pwd as
properties to Surface, adds abstractions necessary to manage that memory
correctly, and also adds a tiny change to renderers to make everything
slightly more usable under Valgrind.
2025-07-21 08:35:55 -07:00
Mitchell Hashimoto
7e834a1c32 apprt/gtk-ng: some actions 2025-07-21 08:15:42 -07:00
Mitchell Hashimoto
edb5f7c69d slow down our cursor timer under valgrind 2025-07-21 07:28:23 -07:00
Mitchell Hashimoto
e911d53a2e apprt/gtk-ng: get-title 2025-07-21 07:16:19 -07:00
Mitchell Hashimoto
ef686d62aa apprt/gtk-ng: clear memory properly 2025-07-21 07:08:46 -07:00
Mitchell Hashimoto
cd82a610c3 apprt/gtk-ng: abstract helper for private string fields 2025-07-21 06:55:28 -07:00
Mitchell Hashimoto
9440c775c7 apprt/gtk-ng: set title 2025-07-20 15:23:43 -07:00
Mitchell Hashimoto
793e271989 apprt/gtk-ng: set pwd 2025-07-20 15:17:03 -07:00
Mitchell Hashimoto
a88689ca75 apprt/gtk-ng: mouse shape,visibility (#7999)
Relatively simple port. A few cool things:

1. We use properties on `GhosttySurface` to set this now and standard
property listeners
2. We make `terminal.MouseShape` a GObject enum if we have gobject
available.
3. The property based approach means we don't have to manage
`*gdk.Cursor` memory anywhere anymore.

And, we're still Valgrind clean.
2025-07-20 14:53:24 -07:00
Mitchell Hashimoto
fb2021bc9f apprt/gtk-ng: correct default mouse shapes 2025-07-20 14:39:02 -07:00
Mitchell Hashimoto
4ffbd93ab5 apprt/gtk-ng: surface mouse visibility 2025-07-20 14:35:16 -07:00
Mitchell Hashimoto
ecd14a8739 apprt/gtk-ng: surface mouse shape 2025-07-20 14:35:16 -07:00
Mitchell Hashimoto
2c6d978ed5 pkg/oniguruma: fix memory leak for failed regex searches (#7998)
Found by Valgrind:

```
==265734== 320 bytes in 8 blocks are definitely lost in loss record 13,786 of 15,141
==265734==    at 0x5A65810: malloc (in /nix/store/l431jn8ahj09g5c1arrl7q6wcxngg21q-valgrind-3.24.0/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==265734==    by 0x3D799EB: onig_region_resize (.cache/zig/p/N-V-__8AAHjwMQDBXnLq3Q2QhaivE0kE2aD138vtX2Bq1g7c/src/regexec.c:923)
==265734==    by 0x3D81BCA: onig_region_resize_clear (.cache/zig/p/N-V-__8AAHjwMQDBXnLq3Q2QhaivE0kE2aD138vtX2Bq1g7c/src/regexec.c:949)
==265734==    by 0x3DA814F: search_in_range (.cache/zig/p/N-V-__8AAHjwMQDBXnLq3Q2QhaivE0kE2aD138vtX2Bq1g7c/src/regexec.c:5454)
==265734==    by 0x3DA7F25: onig_search (.cache/zig/p/N-V-__8AAHjwMQDBXnLq3Q2QhaivE0kE2aD138vtX2Bq1g7c/src/regexec.c:5414)
==265734==    by 0x382E7E8: regex.Regex.searchAdvanced (regex.zig:61)
==265734==    by 0x382E974: regex.Regex.search (regex.zig:48)
==265734==    by 0x382EC08: terminal.StringMap.SearchIterator.next (StringMap.zig:40)
==265734==    by 0x39ADDCD: renderer.link.Set.matchSetFromLinks (link.zig:320)
==265734==    by 0x39AE5C7: renderer.link.Set.matchSet (link.zig:95)
==265734==    by 0x39BCCE1: renderer.generic.Renderer(renderer.OpenGL).rebuildCells (generic.zig:2307)
==265734==    by 0x39C3BDB: renderer.generic.Renderer(renderer.OpenGL).updateFrame (generic.zig:1228)
==265734==    by 0x3993E88: renderer.Thread.renderCallback (Thread.zig:607)
==265734==    by 0x3993CFF: renderer.Thread.wakeupCallback (Thread.zig:524)
==265734==    by 0x39C522E: callback (async.zig:679)
==265734==    by 0x39C522E: watcher.async.AsyncEventFd(api.Xev(.io_uring,backend.io_uring)).waitPoll__anon_592685__struct_596870.callback (async.zig:181)
==265734==    by 0x3970EAE: backend.io_uring.Completion.invoke (io_uring.zig:804)
==265734==    by 0x3973AD8: backend.io_uring.Loop.tick___anon_586861 (io_uring.zig:193)
==265734==    by 0x3973BCD: backend.io_uring.Loop.run (io_uring.zig:84)
==265734==    by 0x3978673: dynamic.Xev(&.{ .io_uring, .epoll }[0..2]).Loop.run (dynamic.zig:172)
==265734==    by 0x3978972: renderer.Thread.threadMain_ (Thread.zig:263)
==265734==    by 0x3954580: renderer.Thread.threadMain (Thread.zig:202)
==265734==    by 0x39279CA: Thread.callFn__anon_573552 (Thread.zig:488)
==265734==    by 0x38F4594: Thread.PosixThreadImpl.spawn__anon_570448.Instance.entryFn (Thread.zig:757)
==265734==    by 0x6E567EA: start_thread (pthread_create.c:448)
==265734==    by 0x6ED9FB3: clone (clone.S:100)
==265734==
```
2025-07-20 14:29:40 -07:00
Mitchell Hashimoto
9bdc29e00f pkg/oniguruma: fix memory leak for failed regex searches
Found by Valgrind:

```
==265734== 320 bytes in 8 blocks are definitely lost in loss record 13,786 of 15,141
==265734==    at 0x5A65810: malloc (in /nix/store/l431jn8ahj09g5c1arrl7q6wcxngg21q-valgrind-3.24.0/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==265734==    by 0x3D799EB: onig_region_resize (.cache/zig/p/N-V-__8AAHjwMQDBXnLq3Q2QhaivE0kE2aD138vtX2Bq1g7c/src/regexec.c:923)
==265734==    by 0x3D81BCA: onig_region_resize_clear (.cache/zig/p/N-V-__8AAHjwMQDBXnLq3Q2QhaivE0kE2aD138vtX2Bq1g7c/src/regexec.c:949)
==265734==    by 0x3DA814F: search_in_range (.cache/zig/p/N-V-__8AAHjwMQDBXnLq3Q2QhaivE0kE2aD138vtX2Bq1g7c/src/regexec.c:5454)
==265734==    by 0x3DA7F25: onig_search (.cache/zig/p/N-V-__8AAHjwMQDBXnLq3Q2QhaivE0kE2aD138vtX2Bq1g7c/src/regexec.c:5414)
==265734==    by 0x382E7E8: regex.Regex.searchAdvanced (regex.zig:61)
==265734==    by 0x382E974: regex.Regex.search (regex.zig:48)
==265734==    by 0x382EC08: terminal.StringMap.SearchIterator.next (StringMap.zig:40)
==265734==    by 0x39ADDCD: renderer.link.Set.matchSetFromLinks (link.zig:320)
==265734==    by 0x39AE5C7: renderer.link.Set.matchSet (link.zig:95)
==265734==    by 0x39BCCE1: renderer.generic.Renderer(renderer.OpenGL).rebuildCells (generic.zig:2307)
==265734==    by 0x39C3BDB: renderer.generic.Renderer(renderer.OpenGL).updateFrame (generic.zig:1228)
==265734==    by 0x3993E88: renderer.Thread.renderCallback (Thread.zig:607)
==265734==    by 0x3993CFF: renderer.Thread.wakeupCallback (Thread.zig:524)
==265734==    by 0x39C522E: callback (async.zig:679)
==265734==    by 0x39C522E: watcher.async.AsyncEventFd(api.Xev(.io_uring,backend.io_uring)).waitPoll__anon_592685__struct_596870.callback (async.zig:181)
==265734==    by 0x3970EAE: backend.io_uring.Completion.invoke (io_uring.zig:804)
==265734==    by 0x3973AD8: backend.io_uring.Loop.tick___anon_586861 (io_uring.zig:193)
==265734==    by 0x3973BCD: backend.io_uring.Loop.run (io_uring.zig:84)
==265734==    by 0x3978673: dynamic.Xev(&.{ .io_uring, .epoll }[0..2]).Loop.run (dynamic.zig:172)
==265734==    by 0x3978972: renderer.Thread.threadMain_ (Thread.zig:263)
==265734==    by 0x3954580: renderer.Thread.threadMain (Thread.zig:202)
==265734==    by 0x39279CA: Thread.callFn__anon_573552 (Thread.zig:488)
==265734==    by 0x38F4594: Thread.PosixThreadImpl.spawn__anon_570448.Instance.entryFn (Thread.zig:757)
==265734==    by 0x6E567EA: start_thread (pthread_create.c:448)
==265734==    by 0x6ED9FB3: clone (clone.S:100)
==265734==
```
2025-07-20 14:17:03 -07:00
Mitchell Hashimoto
98f71d3e7a apprt/gtk-ng: abstract our alert vs msg dialog into a superclass (#7995)
This introduces a new `GhosttyDialog` class that either inherits from
`adw.MessageDialog` or `adw.AlertDialog`, depending on the version of
libadwaita we compile against. This is the same logic we used
previously.

This lets us have a single libadw 1.2 blueprint file for all dialogs and
we just do the right thing at compile time!
2025-07-20 13:21:22 -07:00
Mitchell Hashimoto
001dfcf3d6 apprt/gtk-ng: abstract our alert vs msg dialog into a superclass
This introduces a new `GhosttyDialog` class that either inherits from 
`adw.MessageDialog` or `adw.AlertDialog`, depending on the version of
libadwaita we compile against. This is the same logic we used
previously.

This lets us have a single libadw 1.2 blueprint file for all dialogs and 
we just do the right thing at compile time!
2025-07-20 13:18:56 -07:00
Mitchell Hashimoto
357dd26cf9 apprt/gtk-ng: implement Surface.close (#7994)
A small, simple change. This implements the `Surface.close` apprt
required function. After this PR, a process exiting within the terminal
will close the window properly (unless `wait-after-command` is set of
course!).

This doesn't yet show close confirmation. I'm working on some dialog
refactors on the side to see if we can simplify our Adw 1.2 vs. 1.5
dialogs and didn't want to include it here.

Close now works by the `GhosttySurface` class emitting the
`close-request` signal (similar to a `gtk.Window`) and the parent
container is responsible for closing it. This will let us reuse the
surface within different contexts: tabs, splits, etc.

This also remove the unused `shouldClose`, `setShouldClose` apprt APIs
which are a holdover from the glfw days!
2025-07-20 07:05:12 -07:00
Mitchell Hashimoto
aadb2c05e5 apprt/gtk-ng: hook up Surface.close 2025-07-19 14:19:32 -07:00
Mitchell Hashimoto
2e9ee16455 core: remove Surface.shouldClose
This was a noop in all of our apprts and I think is a holdover from the
glfw days.
2025-07-19 14:03:48 -07:00
Mitchell Hashimoto
aa7cceebe9 gtk: update zig-gobject to get improved gobject accessors (#7992) 2025-07-19 13:20:54 -07:00
Mitchell Hashimoto
8220db8ce1 apprt/gtk-ng: update to the new typedaccessor API 2025-07-19 13:17:17 -07:00
Jeffrey C. Ollie
22b2344f50 gtk: update zig-gobject to get improved gobject accessors 2025-07-19 13:01:33 -07:00
Mitchell Hashimoto
1ec4383931 Fully remove the redrawSurface API (#7991)
This is a tiny addon from the recent gtk-ng work. We've moved redraw
requests into the apprt action system (the `render` action). I waited
until I had my macOS machine to verify that this fix could work. We can
now remove this completely.

We can probably remove the redraw inspector API too at some point but
I'm not there yet with the GTK backend so I'll just wait on it.
2025-07-19 12:59:36 -07:00
Mitchell Hashimoto
7f0c247767 Fully remove the redrawSurface API
This is a tiny addon from the recent gtk-ng work. We've moved redraw
requests into the apprt action system (the `render` action). I waited
until I had my macOS machine to verify that this fix could work. We can
now remove this completely.

We can probably remove the redraw inspector API too at some point but
I'm not there yet with the GTK backend so I'll just wait on it.
2025-07-19 07:30:20 -07:00
Mitchell Hashimoto
88b317dba3 apprt/gtk-ng: surface input (mouse, keyboard, focus, etc.) (#7986)
This ports back all our event controllers back to the `GhosttySurface`. 

With this PR, the terminal is now usable again at a very very simple
level!

This also brings back `winproto` but its still filled with
incompatibilities. I just need to bring that back so modifiers worked
properly. We'll fix that up in a future PR.

This also fixes one undefined memory access in debug modes found by
Valgrind.
2025-07-19 06:42:31 -07:00
Jon Parise
a2b473b77f fish: fix ssh-term infocmp shell expansion (#7960) 2025-07-19 08:00:40 -04:00
HuaDeity
d8c64c0511 Remove unnecessary stderr redirection in fish integration 2025-07-19 16:52:55 +08:00