Commit Graph

12294 Commits

Author SHA1 Message Date
Mitchell Hashimoto
232b1898fa lib-vt: update header comments 2025-09-24 12:50:25 -07:00
Mitchell Hashimoto
390f72accc libghostty-vt C shared library boilerplate, custom allocators API (#8895)
This adds the boilerplate necessary for `libghostty-vt` the C library.

> [!IMPORTANT]
>
> This _does not expose almost any APIs_. The point of this PR is to
setup our boilerplate, build system, docs system, etc. for the
libghostty-vt C lib.

- Adds a `zig build lib-vt` target to _only_ build `libghostty-vt`
- Adds the beginning of `include/ghostty-vt.h` for the C API 
- Adds a full custom allocator interface to the C API mimicking Zig
custom allocators
- Adds an example in `example/c-vt` that builds a pure C program and
links to our shared library and calls functions
- Adds the `osc_parser_new/free` C APIs just as a proof of concept that
things work
- Adds a basic Doxygen config so we have _something_ (I'm not at all
committed to Doxygen, but want us to doc from the beginning)
- Updates CI to test building the shared library for macOS, Windows, and
Linux (yes, it builds for Windows!)

**Note:** To use the `dep.artifact` function provided by Zig, we must
install the artifact. But this means that every `zig build` now includes
`libghostty-vt`. That... could be completely fine, but it's something to
consider for packagers.

## Bikeshed

We're at a pivotal point where we must define the general _style_ of our
C API.

This includes the very bike shed things such as capitalization styling,
but also general API form.

ABI compatibility will eventually be important.

I'm very much open and would love to receive feedback form more
experience C programmers on what they feel would constitute a good API.
I've consumed _many_ C APIs but I haven't provided many directly.

cc @gpanders
2025-09-24 12:45:34 -07:00
Mitchell Hashimoto
37372fa50b more docs 2025-09-24 12:45:21 -07:00
Mitchell Hashimoto
37e238c2f6 remove vt prefixes 2025-09-24 12:36:50 -07:00
Mitchell Hashimoto
96e9053862 move header into subdirectory 2025-09-24 12:30:37 -07:00
Mitchell Hashimoto
48827b21d8 some PR feedback 2025-09-24 12:25:43 -07:00
Mitchell Hashimoto
513cdf667b build: add pkg-config for libghostty-vt 2025-09-24 12:22:09 -07:00
Mitchell Hashimoto
0944f051aa terminal: simplify opaque type 2025-09-24 11:09:19 -07:00
Mitchell Hashimoto
4d165fbaaa remove unused items 2025-09-24 11:06:23 -07:00
Mitchell Hashimoto
43089a01f1 lib: c allocator can use fromZig 2025-09-24 11:00:48 -07:00
Mitchell Hashimoto
fba953feeb ci: run the c-vt example 2025-09-24 10:46:43 -07:00
Mitchell Hashimoto
e7a0198103 lib-vt: docs 2025-09-24 10:46:24 -07:00
Mitchell Hashimoto
2c78ad8889 lib-vt: setup a default allocator if null 2025-09-24 10:30:13 -07:00
Mitchell Hashimoto
de013148d3 build: install the ghostty-vt artifact 2025-09-24 10:17:50 -07:00
Mitchell Hashimoto
e1429dabae example/c-vt 2025-09-24 09:54:08 -07:00
Mitchell Hashimoto
969fcfaec3 lib: allocator interface based on Zig allocators 2025-09-24 09:27:17 -07:00
Mitchell Hashimoto
32bf37e5e4 setup basic doxygen for docs
We may not stick with Doxygen, but it gives us something to start with.
2025-09-23 15:51:27 -07:00
Mitchell Hashimoto
def4969aff build: shared object is a dylib on macOS 2025-09-23 15:15:16 -07:00
Mitchell Hashimoto
3d04fbb451 ci: build lib-vt for a variety of targets
We don't run our tests on all these targets so its not sure they all
will function correctly, but at least we can be sure they build.
2025-09-23 15:04:24 -07:00
Mitchell Hashimoto
85345c31cf build: don't add deps when cross compiling to darwin 2025-09-23 15:03:55 -07:00
Mitchell Hashimoto
b006101ddd lib-vt: boilerplate to build a shared object 2025-09-23 12:35:39 -07:00
Mitchell Hashimoto
f97518cc10 example/zig-vt: add comment explaining how to get zero-dep build 2025-09-23 11:55:44 -07:00
Mitchell Hashimoto
31af87e021 macOS: Convert Sources to folder references (#8856)
https://github.com/ghostty-org/ghostty/discussions/8855
2025-09-23 11:29:32 -07:00
Leah Amelia Chen
2a24918eec deps: removing utf8proc (#8866) 2025-09-23 20:05:03 +02:00
Paal Øye-Strømme
bd9bc5f1b9 deps: removing utf8proc
utf8proc is no longer being used

Per #808, it should be removed.

Link: https://github.com/ghostty-org/ghostty/discussions/6931
Link: https://github.com/ghostty-org/ghostty/discussions/2563
2025-09-23 17:38:03 +02:00
Lars
9072bab6b8 Update iOS membership exceptions 2025-09-23 16:50:13 +02:00
Mitchell Hashimoto
f8472cb32b feat: list-themes cursor and selection colors (#8848)
Closes #8446

Adds the remaining theme colors: cursor-color, cursor-text,
selection-background, and selection-foreground.

## Before
<img width="1840" height="1195" alt="image"
src="https://github.com/user-attachments/assets/f39f0cf1-f1c4-468c-a706-a39e3efe2883"
/>

## After
<img width="1840" height="1195" alt="image"
src="https://github.com/user-attachments/assets/a6995c35-070d-4971-9caf-ebae994deba5"
/>
2025-09-23 06:47:49 -07:00
Mitchell Hashimoto
0bbe39fb0a ci: fix missing var name 2025-09-23 06:45:03 -07:00
Mitchell Hashimoto
52c0afcc93 ci: Add test for building with i18n on and off (#8858)
Closes #8360
2025-09-23 06:42:12 -07:00
Mitchell Hashimoto
862e19cbab deps: Allow dynamic-linking of spirv-cross (#8859)
- Use the pkg-config name of 'spirv-cross-c-shared' exported by the
upstream SPIRV-Cross build
https://github.com/KhronosGroup/SPIRV-Cross/blob/main/pkg-config/spirv-cross-c-shared.pc.in
2025-09-23 06:38:43 -07:00
azhn
a9c5a05e5b deps: Allow dynamic-linking of spirv-cross
- Use the pkg-config name of 'spirv-cross-c-shared' exported by the upstream SPIRV-Cross build
2025-09-23 20:49:22 +10:00
azhn
aa52e11c34 ci: Add test for building with i18n on and off 2025-09-23 20:03:26 +10:00
Kat
3eb646ea6b Add zh_TW Traditional Chinese locale (#6773)
🎉
2025-09-23 08:33:46 +00:00
Lars
131f4fb8b1 Convert Sources to folder references 2025-09-23 09:30:49 +02:00
Mitchell Hashimoto
e951dedc66 GTK Fix unfocused-split-fill (#8813)
Attempts a resolution for
https://github.com/ghostty-org/ghostty/discussions/8572

This matches the behavior of the old GTK apprt where
unfocused-split-fill /opacity doesn't apply when there is only one
active surface.
2025-09-22 19:58:50 -07:00
rhodes-b
36e09cdbe1 remove debug print from helping something with graphics issues 2025-09-22 21:30:03 -05:00
rhodes-b
f36ccc4866 remove is_split properity in priv since it has a getter method 2025-09-22 21:22:53 -05:00
CoderJoshDK
2aad450d2e feat: list-themes cursor and selection colors 2025-09-22 21:18:37 -04:00
Mitchell Hashimoto
8cb52323e5 ghostty-vt Zig Module (#8840)
This makes a `ghostty-vt` Zig module available from our `build.zig` that
contains a reusable Zig API version of our core terminal emulation layer
including escape sequence parsing, terminal state, and screen state.
This is the groundwork for phase one of my "libghostty" vision.

With SIMD disabled, `ghostty-vt` has no dependencies -- not even on libc
-- and can produce fully static standalone binaries. With SIMD enabled,
`ghostty-vt` only depends on libc.

The point of this PR is primarily to get the bug fixes I found in and to
get this running in CI on every commit so that we don't regress it. In
the future we'll do more (see the future section below).

> [!WARNING]
> **The API is extremely not stable and will definitely change in the
future.** The _functionality/logic_ is very stable, because it's the
same core logic used by Ghostty, but the API itself is not at all. For
this PR, we mostly just expose everything and we'll reshape the API
later.

## What is `libghostty-vt`? 

I've stated my vision for a `libghostty` for some time. You can find
background on that. Recently, I've realized that the _scope_ of
`libghostty` is way too large to ship as a single unit. To that end,
`libghostty` will be split into smaller scoped sub-libraries (that may
depend on each other for higher level functionality). The exact mapping
is being worked out.

**The first library I'm extracting is `libghostty-vt` (both Zig and C,
this PR starts with Zig).** This will be a library focused only on core
terminal emulation, terminal state, and screen state. It lacks rendering
support and input handling.

**But why?** The core terminal emulation is the primary source of both
missing functionality and bugs within terminal emulators. Look at this
[simple bug in jediterm](https://github.com/JetBrains/jediterm/pull/311)
that fails to parse a trivially common sequence resulting in horrendous
misrenders. Jediterm is used by every JetBrains IDE! Literally the core
terminal in a many-millions-of-dollars business!

`libghostty-vt` is a _zero dependency_ terminal emulation layer that
exposes a C API which will let any popular language build bindings so
that we can stop reinventing the terminal emulation layer and get best
in class (or near it) terminal emulation capabilities everywhere.

## In This PR

- `ghostty-vt` Zig module
- Example usage of it in `example/zig-vt`
- CI to run Zig module tests, test that our examples build, and test
SIMD on/off
- New feature build flag `-Dsimd` (default on) that turns SIMD on or off
- Unexposed feature flag that allows building the core terminal logic
without regex support (default on right now jus for the ghostty-vt
module as I figure out what our future regex story is in a post-oni
world).
- Fixes for non-SIMD builds

## Future

There's a lot to do in the future outside of this PR:

- Define a more stable Zig API
- Define a C API at all
- Figure out our regex engine story
- Documentation improvements
2025-09-22 10:06:36 -07:00
Mitchell Hashimoto
c177716ac6 build: some docs 2025-09-22 09:53:22 -07:00
Mitchell Hashimoto
8477b6a21a simd: scalar base64 ignores invalid padding 2025-09-22 09:44:58 -07:00
Mitchell Hashimoto
530633b9e9 simd: fix scalar utf8 decoding 2025-09-22 09:29:08 -07:00
Mitchell Hashimoto
5a29dd3ef5 build: make build_options generally available 2025-09-22 08:35:44 -07:00
Mitchell Hashimoto
6893024c51 simd: add scalar fallbacks to all for build_options.simd false 2025-09-22 08:26:53 -07:00
Mitchell Hashimoto
8aa4373aaf ci: add simd on/off test 2025-09-22 06:48:07 -07:00
rhodes-b
fd9014952f use getter to notify is-split property 2025-09-21 22:59:42 -05:00
Mitchell Hashimoto
9c92c3bb81 fastmem non-libc needs to use copyBackwards if dest > src
This fixes test failures when Ghostty's core is run without libc. 
Ghostty in the real world (all built executables) require libc so this
bug has never been hit before, but I'm working on a libc-less core and
this caused real test failures (so its already tested, as well).
2025-09-21 20:48:18 -07:00
Mitchell Hashimoto
dfda3ac280 ci: fix example build 2025-09-21 20:39:43 -07:00
Mitchell Hashimoto
3e1ba35843 terminal: fix mistaken gtk logic 2025-09-21 20:29:18 -07:00
Mitchell Hashimoto
14eb8aa4e4 Add simd flag for disabling SIMD functionality 2025-09-21 20:27:34 -07:00