-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat(terminal): integrate ghostty-vt for terminal emulation #25539
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
f30046f
e713816
ebb2737
c0e1f30
2071742
48b027e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # Build libghostty-vt - Terminal VT emulator library from Ghostty | ||
| # This clones the ghostty repository so Bun's build.zig can import it as a Zig module. | ||
| # | ||
| # libghostty-vt provides: | ||
| # - Terminal escape sequence parsing | ||
| # - Terminal state management (screen, cursor, scrollback) | ||
| # - Input event encoding (Kitty keyboard protocol) | ||
| # - OSC/DCS/CSI sequence handling | ||
| # | ||
| # Usage in Zig: @import("ghostty") gives access to the lib_vt.zig API | ||
|
|
||
| register_repository( | ||
| NAME | ||
| ghostty | ||
| REPOSITORY | ||
| ghostty-org/ghostty | ||
| TAG | ||
| v1.1.3 | ||
| ) | ||
|
|
||
| # utfcpp - header-only UTF-8 library for error handling in SIMD code | ||
| register_repository( | ||
| NAME | ||
| utfcpp | ||
| REPOSITORY | ||
| nemtrif/utfcpp | ||
| TAG | ||
| v4.0.5 | ||
| ) | ||
|
|
||
| # The ghostty source is cloned to ${VENDOR_PATH}/ghostty | ||
| # Bun's build.zig will reference it directly as a Zig module | ||
|
|
||
| # Build the SIMD acceleration library for ghostty | ||
| # This provides optimized UTF-8 decoding for terminal escape sequence parsing | ||
| set(GHOSTTY_SIMD_SRC ${VENDOR_PATH}/ghostty/src/simd/vt.cpp) | ||
|
|
||
| add_library(ghostty-simd STATIC ${GHOSTTY_SIMD_SRC}) | ||
|
|
||
| target_include_directories(ghostty-simd PRIVATE | ||
| # Bun's compatibility headers (simdutf.h wrapper) | ||
| ${CWD}/src/deps/ghostty | ||
| # Ghostty's own headers | ||
| ${VENDOR_PATH}/ghostty/src | ||
| # Highway SIMD library (from Bun's vendor) | ||
| ${BUILD_PATH}/highway | ||
| ${VENDOR_PATH}/highway | ||
| # simdutf from webkit | ||
| ${WEBKIT_INCLUDE_PATH} | ||
| ${WEBKIT_INCLUDE_PATH}/wtf | ||
| # utfcpp for UTF-8 error handling | ||
| ${VENDOR_PATH}/utfcpp/source | ||
| ) | ||
|
|
||
| target_compile_definitions(ghostty-simd PRIVATE | ||
| # Highway configuration | ||
| HWY_STATIC_DEFINE | ||
| ) | ||
|
|
||
| # Enable exceptions for this file only - utfcpp's replace_invalid uses them | ||
| set_source_files_properties(${GHOSTTY_SIMD_SRC} PROPERTIES | ||
| COMPILE_FLAGS "-fexceptions" | ||
| ) | ||
|
|
||
| # Ensure dependencies are built first | ||
| add_dependencies(ghostty-simd clone-ghostty clone-utfcpp) | ||
| if(TARGET highway) | ||
| add_dependencies(ghostty-simd highway) | ||
| endif() | ||
|
|
||
| # Link ghostty-simd into bun | ||
| target_link_libraries(${bun} PRIVATE ghostty-simd) | ||
|
|
||
| # Link highway library | ||
| target_link_libraries(${bun} PRIVATE ${BUILD_PATH}/highway/libhwy.a) | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: oven-sh/bun
Length of output: 630
Update ghostty and utfcpp to newer versions.
Ghostty v1.2.3 (released October 23, 2025) is available; the current pin to v1.1.3 is outdated. Ghostty v1.2.0 (September 15, 2025) introduced a security fix where Ghostty now unconditionally asks for permission prior to executing any script or executable, which is not present in v1.1.3.
For utfcpp, v4.0.8 (released September 2025) is the latest available; the current pin to v4.0.5 (released December 2023) is nearly two years old with multiple newer patch releases (v4.0.6, v4.0.7, v4.0.8) available.
🤖 Prompt for AI Agents