-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ghostty-vt Zig Module #8840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
ghostty-vt Zig Module #8840
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes a
ghostty-vtZig module available from ourbuild.zigthat 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-vthas no dependencies -- not even on libc -- and can produce fully static standalone binaries. With SIMD enabled,ghostty-vtonly 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
libghosttyfor some time. You can find background on that. Recently, I've realized that the scope oflibghosttyis way too large to ship as a single unit. To that end,libghosttywill 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 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-vtis 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-vtZig moduleexample/zig-vt-Dsimd(default on) that turns SIMD on or offFuture
There's a lot to do in the future outside of this PR: