Commit Graph

13712 Commits

Author SHA1 Message Date
Mitchell Hashimoto
7bfcaef1e8 terminal: formatting feedback 2026-01-07 13:12:37 -08:00
Eric Bower
f316c969a5 chore: update test expectation 2026-01-01 20:24:33 -05:00
Eric Bower
ea03c5c8a2 fix: reset style to prevent bleeding bg colors newline 2026-01-01 20:15:41 -05:00
Eric Bower
6fdbc29b9a fix(formatter): preserve background colors on cells without text
The VT formatter was treating cells without text as blank and emitting
them as plain spaces, losing any background color styling. This caused
TUIs like htop to lose their background colors when rehydrating terminal
state (e.g., after detach/reattach in zmx).

For styled formats (VT/HTML), cells with background colors or style_id
are now emitted with proper SGR sequences and a space character instead
of being accumulated as unstyled blanks.

Adds handling for bg_color_palette and bg_color_rgb content tags which
were previously unreachable.

Reference: https://ampcode.com/threads/T-019b7a35-c3f3-73fc-adfa-00bbe9dbda3c
2026-01-01 20:07:27 -05:00
Eric Bower
c081adce05 chore: write page vt test bg color with trailing row
The issue is in ghostty_src/src/terminal/formatter.zig#L1117-L1129:

- Cells without text are treated as "blank" (line 1117-1119) - this includes cells that only have background colors
- When blank cells are emitted, they're plain spaces (line 1129) - writer.splatByteAll(' ', blank_cells) outputs spaces without any SGR styling
- Background-only cells (bg_color_palette, bg_color_rgb) are marked unreachable (lines 1233-1235) because the code assumes hasText() already filtered them

This means when htop draws a row like:

`[green bg]CPU: 45%[red bg]          [default]`

The trailing cells with red background but no text get accumulated as blanks and emitted as plain spaces - losing the background color.
2026-01-01 10:47:40 -05:00
Mitchell Hashimoto
3a89c8ac54 Update Imgui from 1.90.6 to 1.92.5, use Dear Bindings instead of cimgui (#10118)
This updates our Imgui version from 1.90.6 to 1.92.5 which is almost 18
months of changes. In the process, we've also migrated from cimgui to
Dear Bindings, the official way to do C bindings.

This PR doesn't contain any functionality changes, only the dependency
change and API changes necessary to achieve the same behavior.
2025-12-31 13:53:36 -08:00
Mitchell Hashimoto
c694517432 update gitattributes, removed file 2025-12-31 13:42:00 -08:00
Mitchell Hashimoto
8449c3efb8 update all deps 2025-12-31 13:39:19 -08:00
Mitchell Hashimoto
82e585ad9a remove pkg/cimgui 2025-12-31 13:38:40 -08:00
Mitchell Hashimoto
f2bc722a58 pkg/dcimgui: fix wchar size mismatch 2025-12-31 13:36:40 -08:00
Mitchell Hashimoto
965ffb1750 pkg/dcimgui: add freetype 2025-12-31 13:20:27 -08:00
Mitchell Hashimoto
f1ba5297b8 build: fix imgui on GTK 2025-12-31 13:20:03 -08:00
Mitchell Hashimoto
896361f426 Fix up API calls for initialization 2025-12-31 13:01:28 -08:00
Mitchell Hashimoto
978400b0b0 replace cimgui with dcimgui 2025-12-31 10:42:10 -08:00
Mitchell Hashimoto
3bd898603a pkg/dcimgui: DearBindings-based Imgui support 2025-12-31 10:11:43 -08:00
Mitchell Hashimoto
d3666d6ef9 macOS: Dragging last split out of tab should close tab, not window (#10113)
This makes it so that dragging a split over a tab in our app will focus
that tab. Presently, it's very hard if not impossible to get the drag to
focus the tab. This just does it manually.

This also fixes a bug where the last split drop out of a tab will close
the entire window, this affects main currently too.

This is still a draft because I'm chasing down one issue still where the
dropped surface fails to render properly and its unclear why yet.
2025-12-31 06:16:55 -08:00
Mitchell Hashimoto
18abcaa797 macos: remove tab hover event, seems native handles it 2025-12-31 06:15:04 -08:00
Mitchell Hashimoto
d4ba0fa27e macos: last surface should close tab immediately not window 2025-12-30 15:07:28 -08:00
Mitchell Hashimoto
3e399a3d35 macos: detect surface tab bar hovers and focus them 2025-12-30 15:07:27 -08:00
Mitchell Hashimoto
f32d54bedb macos: make surface grab handle visible in light mode (#10111) 2025-12-30 13:14:49 -08:00
Mitchell Hashimoto
faa89ba280 macos: Ghostty.Command must copy string values (#10112)
We were previously storing the C struct which contained pointers into
ephemeral memory that could cause segfaults later on. I think this was a
tip regression, because in 1.2 despite doing this, we always referenced
static memory so it was fine. With tip, we now accept custom command
palette entries so it's dynamically allocated.
2025-12-30 13:13:41 -08:00
Mitchell Hashimoto
c34bb5976a macos: Ghostty.Command must copy string values
We were previously storing the C struct which contained pointers into
ephemeral memory that could cause segfaults later on.
2025-12-30 13:09:20 -08:00
Mitchell Hashimoto
43c7277a60 macos: make surface grab handle visible in light mode 2025-12-30 13:06:55 -08:00
Mitchell Hashimoto
6a1a4eee28 Update Vim filetype detection patterns (#10101)
Fixes #10094
2025-12-30 08:11:14 -08:00
Mitchell Hashimoto
b7e1852fb9 Refactor nautilus extension (#10106)
Following #10082 I took the opportunity to clean up the code in the
nautilus extension a little. Specifically, this pull request

- turns methods that weren't using `self` into functions,
- inlines a helper method that was trivial after #10082,
- extracts duplicate code in both menu item callbacks into a new helper
function, and
- removes the compatibility hack for the Nautilus 3.0 API, i.e. GNOME 42
and older.

I'm not that sure about the last point, as it's not clear to me what the
support baseline is here: GNOME 43 (the first version to support the
Nautilus 4.0 API) was released in Sep 2022, i.e. is almost as old as
Ghostty itself. The previous Debian stable release already included
GNOME 43, but Ubuntu 22.04 (the LTS before the current 24.04 LTS) still
includes GNOME 42. Does Ghostty support a system that old? If so, I'll
drop the corresponding commit from this PR.
2025-12-30 07:30:22 -08:00
Mitchell Hashimoto
b52a145bf6 macos: keep glass titlebar inset in sync when tab bar appears (#10105)
Discussion: https://github.com/ghostty-org/ghostty/discussions/10104

Summary:
When background blur uses macOS glass styles, the titlebar becomes fully
transparent after opening a new tab. This updates the glass effect
view’s top inset during layout so
the glass layer continues to cover the titlebar area.

Root Cause:
The glass effect view’s top constraint is computed once using the theme
frame’s safe-area top inset. On macOS 26, opening a new tab changes the
titlebar height/safe-area,
but the constraint is never refreshed. That leaves an uncovered strip at
the top, which appears fully transparent.

Fix:
Track the glass view’s top constraint and update its constant on layout.
This keeps the glass layer aligned with the current safe-area inset
while avoiding unnecessary
reconfiguration.

Tests:
- Manual: `zig build run`, open a new tab with `background-opacity < 1`
and `background-blur = macos-glass-regular` and confirm titlebar is no
longer fully transparent.
- Note: automated tests not added; UI behavior is hard to exercise in
existing test suite.

Window position question:
Opening a new tab seems to reset the window position / trigger a
maximize-like behavior on my system. Is this intended (feature) or a
bug? I did not change this behavior in this PR.

AI Assistance:
This change was implemented with AI assistance (Codex) and reviewed by
me.
2025-12-30 07:21:32 -08:00
Sebastian Wiesner
ab4b54e2a4 Drop GNOME 42 compatibility
GNOME 43 is from 2022-09, i.e. almost as old as Ghostty, so  not longer
worth supporting here.
2025-12-30 13:30:18 +01:00
Sebastian Wiesner
5c35a4710d Rename class
It's a menu provider not a single action.
2025-12-30 13:30:18 +01:00
Sebastian Wiesner
dee093db57 Extract duplicated code into single helper
Extract duplicated code from the two different menu item hooks into a
single helper function, and then inline _make_item, as it's only used
once now.
2025-12-30 13:30:18 +01:00
Sebastian Wiesner
09d6a1ee2e Lift functions out of class
Neither of these used self.
2025-12-30 13:30:18 +01:00
Sebastian Wiesner
f1bed9dd6a Inline trivial method 2025-12-30 13:30:18 +01:00
John Xu
53c510ac40 macos: keep glass titlebar inset in sync on layout 2025-12-30 16:32:12 +08:00
qingyunha
5c4af69765 Update Vim filetype detection patterns
Fixes #10094
2025-12-30 08:47:18 +08:00
Jeffrey C. Ollie
1fa6641a6a Remove systemd integration from nautilus extension (#10082)
As far as I understand ghostty already integrates with systemd nowadays,
and manages its own scopes/cgroups for the application and all tabs. As
such, explicitly moving launching ghostty into a separate systemd scope
from nautilus no longer seems necessary. In any case the scope created
by the nautilus extension quickly goes away, suggesting that Ghostty
moves its processes out of this scope, and the process tree looks just
the same when spawning ghostty directly.
2025-12-29 16:57:58 -06:00
Sebastian Wiesner
622d49206a Remove unused imports 2025-12-29 22:36:27 +01:00
Sebastian Wiesner
d09bac64ae Remove systemd integration from nautilus extension
As far as I understand ghostty integrates with systemd already nowadays,
and manages its own scopes/cgroups for tabs.  As such, explicitly moving
launching ghostty into a separate systemd scope from nautilus no longer
seems necessary.
2025-12-29 22:36:27 +01:00
Mitchell Hashimoto
b9ad1f05ef input: add end_key_sequence binding action (#10098)
End the currently active key sequence, if any, and flush the keys up to
this point to the terminal, excluding the key that triggered this
action.

For example: `ctrl+w>escape=end_key_sequence` would encode `ctrl+w` to
the terminal and exit the key sequence. Or, more fancy,
`ctrl+w>catch_all=end_key_sequence` would exit the sequence without
encoding whatever key was invalid!

Normally, an invalid sequence will reset the key sequence and flush all
data including the invalid key. This action allows you to flush only the
prior keys, which is useful when you want to bind something like a
control key (`ctrl+w`) but not send additional inputs.
2025-12-29 12:12:16 -08:00
Mitchell Hashimoto
61df50d70b input: add end_key_sequence binding action
End the currently active key sequence, if any, and flush the
keys up to this point to the terminal, excluding the key that
triggered this action.

For example: `ctrl+w>escape=end_key_sequence` would encode
`ctrl+w` to the terminal and exit the key sequence.

Normally, an invalid sequence will reset the key sequence and
flush all data including the invalid key. This action allows
you to flush only the prior keys, which is useful when you want
to bind something like a control key (`ctrl+w`) but not send
additional inputs.
2025-12-29 12:07:54 -08:00
Mitchell Hashimoto
9c9d707fc1 macos: make undo/redo work for final split dragged out (#10097)
Fixes #10093
2025-12-29 11:45:00 -08:00
Mitchell Hashimoto
a826892ef7 macos: make undo/redo work for final split dragged out
Fixes #10093
2025-12-29 11:15:19 -08:00
Mitchell Hashimoto
b3a514f984 macOS: Dragging a split outside of window creates a new window (#10096)
Fixes #10091 

Includes undo/redo.


https://github.com/user-attachments/assets/e533425f-4329-4cce-baac-1c9fadfc3641
2025-12-29 10:57:18 -08:00
Mitchell Hashimoto
7512f6158b macos: fix bugs 2025-12-29 10:47:00 -08:00
Mitchell Hashimoto
19f7b57cd1 macos: fixup focus issues when closing the new window 2025-12-29 10:36:24 -08:00
Mitchell Hashimoto
29edbbbc86 macos: open dragged windows where they are dropped 2025-12-29 10:21:21 -08:00
Mitchell Hashimoto
5ecd26727e macos: allow pulling split out into its own window 2025-12-29 10:11:59 -08:00
Mitchell Hashimoto
89c515cab5 macos: new window from tree in TerminalController 2025-12-29 10:03:36 -08:00
Mitchell Hashimoto
25c413005b macos: emit a notification when the surface drag ends outside area 2025-12-29 09:55:18 -08:00
Mitchell Hashimoto
e3dd5b93e6 gtk: pass through keypress when clipboard has no text (#10089)
## Summary

When `paste_from_clipboard` is triggered but the clipboard contains no
text (e.g., an image), the action now returns `false` to indicate it
couldn't be performed. This enables the `performable:` keybind prefix to
work correctly for paste actions.

## Problem

On GTK/Linux, when a user has `keybind = ctrl+v=paste_from_clipboard`
and the clipboard contains an image (not text), pressing Ctrl+V does
nothing. Applications like `opencode` that handle their own clipboard
reading via `wl-paste` never receive the keypress.

## Solution

Make `clipboardRequest` return `bool` to indicate whether the action
could be performed. For paste requests on GTK, synchronously check if
the clipboard contains text formats before starting the async read. When
no text format is available, return `false`.

Users can now use:
```
keybind = performable:ctrl+v=paste_from_clipboard
```

When the clipboard has no text, the keybind is not consumed and Ctrl+V
passes through to the terminal application.

## Changes

- `Surface.startClipboardRequest` now returns `bool`
- `paste_from_clipboard` / `paste_from_selection` actions return the
result
- GTK apprt checks clipboard formats synchronously before async read
- Embedded apprt always returns `true` (can't check synchronously)

## Testing

1. Add `keybind = performable:ctrl+v=paste_from_clipboard` to config
2. Copy an image to clipboard
3. Open an application that handles image paste (e.g., `opencode`)
4. Press Ctrl+V
5. Image pastes successfully (app receives keypress and handles
clipboard itself)

## Disclaimer

Most of the changes is done with Opus 4.5
2025-12-29 09:39:17 -08:00
cyppe
972b65eb1b review 2025-12-29 18:32:25 +01:00
Mitchell Hashimoto
560a58e0ea terminal: PageList needs to fix up viewport pin after row change (#10095)
From #10074

The test comments explain in detail. I also added a new integrity check
to validate this at runtime. All existing tests pass the integrity
check.
2025-12-29 09:15:23 -08:00