Commit Graph

13767 Commits

Author SHA1 Message Date
Lukas
a265462aa6 macOS: moving a focused split to another tab should also update the previous tab 2026-01-07 09:18:41 -08:00
Lukas
02fc0f502f macOS: rename function to avoid mutating misunderstanding 2026-01-07 09:18:17 -08:00
Mitchell Hashimoto
ba1952c8c2 build: add -fPIC for musl targets (#10198)
Adds `-fPIC` flag for musl targets when building highway and simdutf C++
dependencies, matching the existing freebsd behavior.

## What is PIC?

Position Independent Code (PIC) generates machine code using relative
addresses instead of absolute ones, allowing the code to be loaded at
any memory address. This is required when linking static libraries into
shared libraries (.so files).

## Why both freebsd and musl need it

Both freebsd and musl use strict relocation policies that reject non-PIC
code in shared libraries. Without `-fPIC`, linking fails with errors
like:

```
relocation R_X86_64_PC32 cannot be used against symbol '__cxa_begin_catch'
```

glibc is more permissive and handles these relocations at runtime, which
is why linux-gnu targets work without this flag.

## Context

This enables cross-compiling ghostty-vt to musl/Alpine Linux targets.
Discovered while integrating ghostty-vt into opentui:
https://github.com/sst/opentui/pull/440

---

This PR was created with help from Claude Opus 4.5.
2026-01-07 07:03:00 -08:00
Tommy D. Rossi
61394d5213 build: add -fPIC for musl targets in C++ dependencies 2026-01-07 06:55:40 -08:00
Leah Amelia Chen
c559a1dbba Allow for default or inherited CWD in new window, tab and split surfaces (redone for GTK-NG) (#9158) 2026-01-07 20:45:06 +08:00
Mitchell Hashimoto
a4368064a3 macOS: add Cmd+J "Jump to Selection" menu item and default binding (#10197)
This matches other built-in macOS apps like Terminal, Notes, Safari. We
already had the binding, just needed to create the menu.
2026-01-06 14:40:01 -08:00
Mitchell Hashimoto
7d0157e69a macOS: add Cmd+J "Jump to Selection" menu item and default binding
This matches other built-in macOS apps like Terminal, Notes, Safari. We
already had the binding, just needed to create the menu.

https://ampcode.com/threads/T-019b956a-f4e6-71b4-87fa-4162258d33ff
2026-01-06 14:30:11 -08:00
Mitchell Hashimoto
09c7240fb2 macOS: Selection for Find feature (#10192)
Adds the `selection_for_search` action, with Cmd+E keybind by default.
This action inputs the currently selected text into the search field
without changing focus, matching standard macOS behavior.

Implements discussion #9776 and #10036

<details><summary>AI Disclosure</summary>
<p>

Tab completions with Codestral.
Reviewed by Gemini 3 Flash via chatting.
No Agentic coding tools were involved.

</p>
</details>
2026-01-06 14:26:03 -08:00
Mitchell Hashimoto
3ba4f17f0d zig fmt 2026-01-06 14:21:42 -08:00
Mitchell Hashimoto
05a41c7772 macos: clean up menu 2026-01-06 14:20:34 -08:00
Mitchell Hashimoto
f07d600e43 macos: start_search with needle changes needle 2026-01-06 14:14:22 -08:00
Mitchell Hashimoto
8e28f58b42 rename the selection search binding, unify into start_search action 2026-01-06 14:10:42 -08:00
Mitchell Hashimoto
45abfa9190 font: add bitmap font tests for BDF, PCF, and OTB formats (#10193)
Adds test coverage for bitmap font rendering in the FreeType backend
using the Spleen 8x16 font in three formats:

- BDF (Bitmap Distribution Format)
- PCF (Portable Compiled Format)
- OTB (OpenType Bitmap)

Tests validate glyph dimensions and pixel-perfect rendering against
expected patterns, following the model established by the existing
TerminusTTF test.

Spleen was chosen because it ships in all three required formats from a
single source, providing consistent test data across formats. Its BSD
2-Clause license is compatible with the existing font licenses in the
repo (OFL, MIT). No existing embedded fonts could be used since they are
all TTF/OTF files that use the TrueType loader rather than the
BDF/PCF/OTB loaders being tested.

Addresses #8524.

---

This PR was written with assistance from Claude Code.
2026-01-06 09:26:27 -08:00
Britt Binler
896615c004 font: add bitmap font tests for BDF, PCF, and OTB formats
Add test coverage for bitmap font rendering using the Spleen 8x16 font
in three formats: BDF (Bitmap Distribution Format), PCF (Portable
Compiled Format), and OTB (OpenType Bitmap). Tests validate glyph
rendering against expected pixel patterns.

Addresses #8524.
2026-01-06 09:14:33 -08:00
Mitchell Hashimoto
6da5f72c45 Lower unimplemented OSC from warning to debug (#10184)
The "unimplemented OSC command" warning is a frequent source of red
herrings as there are many OSCs that we parse but deliberately do not
implement. It's also a small drag on performance due to the function
call overhead and the overhead of formatting and outputting the message.
This PR lowers the message from warning to debug. Debug logs are
compiled out of release builds so there should be less confusion from
general users who will no longer see the message.
2026-01-06 08:52:54 -08:00
Aaron Ruan
9b6a3be993 macOS: Selection for Find feature
Adds the `selection_for_search` action, with Cmd+E keybind by default.
This action inputs the currently selected text into the search
field without changing focus, matching standard macOS behavior.
2026-01-06 22:21:55 +08:00
Kat
b4a44bc47e i18n: Add missing German translation (#10164) 2026-01-06 13:01:39 +00:00
Jan Klass
1c7ba3dbe0 Update rev date and last translator 2026-01-06 10:26:40 +01:00
Peter Guy
93f33bc0d6 clarify config documentation around previously focused windows/tabs/splits 2026-01-05 16:47:04 -08:00
Peter Guy
55285fee28 preserve multi-line formatting 2026-01-05 16:47:04 -08:00
Peter Guy
b119bc6089 consolidated enums 2026-01-05 16:47:04 -08:00
Peter Guy
d660799723 Consolidate the several ghostty_surface_inherited_config
functions back into a single function with a second parameter for the source context.
2026-01-05 16:47:04 -08:00
Peter Guy
c035fb5385 Add an enum type for the C API 2026-01-05 16:47:04 -08:00
Peter Guy
0af2a3f693 Enable distinguishing between a new tab in a new window
(which should inherit based on the window setting),
and a new tab in an existing window
(which should inherit base on tab setting)
2026-01-05 16:47:04 -08:00
Peter Guy
82614511ab Use the new GTK Surface::setParent from the tab and split 2026-01-05 16:47:04 -08:00
Peter Guy
05229502bf Add the surface context to the Surface's setParent
In order to set the private context variable so that initiSurface can use it.
2026-01-05 16:47:04 -08:00
Peter Guy
496f5b3ed7 Add the context to the Swift layer.
- Define NewSurfaceContext to match the Zig enum name and avoid magic numbers.
2026-01-05 16:47:04 -08:00
Peter Guy
dba0ff5339 Add C API function to handle new surfaces of different types 2026-01-05 16:47:04 -08:00
Peter Guy
7cf4c8dc53 Add context field to C config struct 2026-01-05 16:47:04 -08:00
Peter Guy
02e1a68263 Use config to determine cwd inheritance for windows, tabs, and splits
- Define NewSurfaceContext enum (window, tab, split)
- Add shouldInheritWorkingDirectory helper function
- Thread surface context through newConfig and newSurfaceOptions
- Replace window-inherit-working-directory checks with context-aware logic
- Add context to embedded CAPI and GTK Surface structs
2026-01-05 16:47:04 -08:00
Peter Guy
87fc5357eb Add config entries for tab and split inheritance 2026-01-05 16:47:04 -08:00
Jeffrey C. Ollie
f3e90e23d9 Lower unimplemented OSC from warning to debug 2026-01-05 15:47:49 -06:00
Mitchell Hashimoto
c5bc6bb2ce fix: use flush instead of end on stdout in code generators for Windows compatibility (#10150)
This fixes the Windows build failure discussed in
https://github.com/ghostty-org/ghostty/discussions/10148

When building on Windows, `symbols-unigen` and `props-unigen` crash with
`error.FileTooBig` because `stdout.end()` calls `setEndPos()` to
truncate the output. Windows does not support `SetEndOfFile` on pipes or
console handles - it returns `ERROR_INVALID_PARAMETER`, which Zig maps
to `error.FileTooBig`.

Using `flush()` instead of `end()` is correct here because:

1. `end()` flushes AND truncates - useful when overwriting files that
might have leftover content
2. For stdout captured as a pipe, there's nothing to truncate - we're
writing sequentially to a fresh pipe
3. `flush()` ensures all buffered data is sent, which is all that's
needed

CI before fix was failing with FileTooBig, after fix builds
successfully:
https://github.com/remorses/opentui/actions/runs/20671299561/job/59352503875
2026-01-05 11:44:13 -08:00
Mitchell Hashimoto
09ae4c200c Update iTerm2 colorschemes (#10157)
Upstream release:
https://github.com/mbadolato/iTerm2-Color-Schemes/releases/tag/release-20251229-150532-f279991
2026-01-05 11:35:32 -08:00
Mitchell Hashimoto
dda27d43be font/shaper: Fix CoreText position.y for some scripts (#10179)
This PR simplifies and corrects the logic for placing a glyph
vertically, by using the `position.y` from `CoreText` directly, instead
of using an offset from the cell's starting `y`. The logic was incorrect
from the beginning, always treating the first glyph of a cell as being
at `y` of zero. We only need to be subtracting the cell's starting `x`
to align the glyphs to the cell grid.

Enabling the commented out logging, I found no instances of `position.y
differs from old offset.y` lines with `JetBrains Mono` with ligatures
turned on, but running
[ttylang](https://github.com/jacobsandlund/ttylang) (printing the
Universal Declaration of Human Rights in various languages) revealed 676
instances of this, with many only slightly off.

An example log from some Tai Tham text is the following, and this PR
adds a test based on this:

```
...pos=(0.00,-8.21) run_offset=(69.41,-8.21) cell_offset=(69.41,-8.21) old offset.y=0.00 cps = \u{1a49}\u{1a60} \u{1a3f}▸\u{1a69} \u{1a2f} → ᩉ᩠ᨿᩩᨯ
```

Browsers display this as:

ᩉ᩠ᨿᩩ

`main` is printing:

<img width="852" height="90" alt="CleanShot 2026-01-05 at 10 28 17@2x"
src="https://github.com/user-attachments/assets/c97b738c-8fe4-48b5-81f8-e0e79f1a9269"
/>

this PR prints:

<img width="958" height="90" alt="CleanShot 2026-01-05 at 10 29 07@2x"
src="https://github.com/user-attachments/assets/88fd26a7-8041-4b33-ab02-56f411204b04"
/>

Since this is a ligature of two different grapheme clusters, Ghostty
ends up subtracting too much of the `x` value with the `cell_offset.x`
(starting x), so neither of the screenshots above are correct, but the
second is closer and gets the `y` value right.

AI disclaimer: I didn't use AI for the code, but did ask it about this
Tai Tham text and why it wasn't a single grapheme cluster:
https://ampcode.com/threads/T-019b8ea2-1822-75bb-a8eb-55a9ddb9f7ea
2026-01-05 11:17:16 -08:00
Mitchell Hashimoto
151dd33f31 fix: remove progress bar on reset terminal (#10178)
closes #10168

ai disclosure: i fully used claude code to generate this pr, but change
seems straightforward enough and have manually tested it.
2026-01-05 09:35:36 -08:00
Jacob Sandlund
15899b70fb simplify run_offset_x comment 2026-01-05 10:35:22 -05:00
Jacob Sandlund
7aec7effea Add test for Tai Tham letter position.y difference 2026-01-05 10:12:05 -05:00
Jacob Sandlund
41f63384f5 Turn off debugging 2026-01-05 09:59:37 -05:00
Jacob Sandlund
f31d2b99ae Merge remote-tracking branch 'upstream/main' into coretext-position-y 2026-01-05 09:58:10 -05:00
Jacob Sandlund
d38558aee1 Show current cp with ▸ in list of cps 2026-01-05 09:34:17 -05:00
Peter Cardenas
f36abed35a fix: reset progress bar on reset terminal 2026-01-05 05:26:33 -08:00
Jan Klass
b830a8397c Update po/de_DE.UTF-8.po
Co-authored-by: Klaus Hipp <khipp@users.noreply.github.com>
2026-01-05 10:48:09 +01:00
Jacob Sandlund
1d4a5d91e0 More debugging for position.y differences 2026-01-04 21:24:45 -05:00
Jan Klass
742c9ca390 i18n: Add missing German translation 2026-01-04 23:44:04 +01:00
mitchellh
bd20f844aa deps: Update iTerm2 color schemes 2026-01-04 00:16:28 +00:00
Tommy D. Rossi
e2de0bfd93 fix: clarify error codes in comment 2026-01-03 13:44:29 +01:00
Tommy D. Rossi
4ea669562e fix: use flush instead of end on stdout in code generators for Windows compatibility 2026-01-03 13:43:27 +01:00
Mitchell Hashimoto
1c2db85aa4 fix: Mac window becomes unmovable after pane rearrangement (#10133)
On main, after rearranging panes, the window becomes permanently
immovable. Grab handles temporarily set `window.isMovable = false` on
hover to prevent window dragging from interfering with pane drags
(fixing [#10110](https://github.com/ghostty-org/ghostty/issues/10110)),
but the restoration logic failed when views were destroyed during pane
rearrangement (which happens each time a pane is rearranged).

The previous approach managed `window.isMovable` state across the view
lifecycle:

1. `mouseEntered` → saved and disabled `window.isMovable`
2. View removed during rearrangement → `mouseExited` never fired
3. `deinit` ran with `self.window` already nil → restoration failed
4. Window stuck with `isMovable = false`

Instead of managing window state, prevent the mouseDown event from
reaching the window's drag handler by overriding mouse event handling in
the grab handle view.

Per [Apple's Event Handling
Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/HandlingMouseEvents/HandlingMouseEvents.html):

> Custom NSView objects should not invoke super in their implementations
of NSResponder mouse-event-handling methods such as mouseDown:,
mouseDragged: and mouseUp: unless it is known that the inherited
implementation provides some needed functionality.

This eliminates all state management while solving both the original
issue (#10110) and the new bug.

AI disclosure: claude code found and wrote the fix. I tested it manually
to see that it works. I pressed claude quite hard here to come up with
the best fix, and looked at documentation to understand what the fix was
doing. It seems like this is a better approach overall to preventing the
main window from being dragged when grabbing the Surface Drag handle.
2026-01-01 16:21:15 -08:00
Martin Emde
c384cd050e Fix Mac window becomes unmovable after pane rearrangement
After rearranging panes, the window becomes permanently unmovable.
Grab handles temporarily set `window.isMovable = false` on hover to prevent
window dragging from interfering with pane dragging.

Override `viewWillMove(toWindow:)` to catch when the view is being removed from
the window. This lifecycle method is called before the window reference
becomes nil, allowing us to restore `window.isMovable`.
2026-01-01 15:56:25 -08:00