alpha
Login
or
Join now
ptr.pet
/
ghostty
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
ghostty
/
src
/
terminal
/
at
main
7 folders
48 files
Mitchell Hashimoto
terminal: support click_events=2 (#12953)
2mo ago
69095e29
apc
terminal: hook up glyph protocol glossary to terminal state This hooks up the glyph protocol glossary to the terminal state. This effectively makes us handle the APC protocol for it both in Ghostty GUI and libghostty, although we didn't implement the renderer yet. The Zig/C libghostty API also has a way to disable the protocol but it is enabled by default. The memory usage is bound by the specification. For dirty tracking for the renderer, we're going with the simple route that any glyph change marks a coarse grained dirty flag and we'll [in the future] rebuild the entire state in the renderer. I think this will be fine for realistic workloads, but we can reassess in the future when we have real workloads.
2 months ago
c
lib-vt: add pwd_changed callback for OSC 7/9/1337 Previously the libghostty-vt stream handler dropped .report_pwd as a no-op, so embedders never saw shell-reported cwd changes and the terminal's pwd field was never populated from escape sequences. Wire the action to setPwd and expose a pwd_changed callback analogous to title_changed via GHOSTTY_TERMINAL_OPT_PWD_CHANGED. The payload is passed through unparsed; embedders read it with ghostty_terminal_get and decode any URI scheme themselves.
2 months ago
kitty
os: use GetTempPathW for allocTmpDir on Windows `allocTmpDir` previously read `%TMP%` via `getenvW` and returned `null` if the variable wasn't set, requiring each caller to to deal with the nullable. Unfortunately, there isn't a platform-neutral default value that makes sense for those cases (i.e. `/tmp` is POSIX-y). We now use `GetTempPathW` on Windows, which is the official way to get this directory: `TMP` → `TEMP` → `USERPROFILE` → `GetWindowsDirectoryW`. With a real system call behind it, the function no longer needs to be nullable: the only remaining failure modes are OOM (propagated) and the syscall itself failing or returning data we can't decode. In those later cases, we use `C:\Windows\Temp` as a fallback, similar to how we use `/tmp` in the POSIX case. The Windows path always allocates so it still must be paired with `freeTmpDir`, which matches the existing contract.
3 months ago
osc
fix: fix tests, change enum fields to lowercase
2 months ago
res
terminal: adjust page capacity for graphemes if necessary
2 years ago
search
fix(terminal): avoid integer overflow in selectPrev with no active matches
2 months ago
tmux
Fix tmux control parser premature %end/%error block termination (#11597) Fixes [#11935.](https://github.com/ghostty-org/ghostty/issues/11395) I’m new to Zig, so I used AI assistance (Codex) while preparing this change. Before opening this PR, I manually reviewed every line of the final patch and stepped through the parser in LLDB to verify the behavior. Happy to make any changes. To better understand the parser, I also built a small model-checker model [here](https://gist.github.com/wyounas/284036272ba5893b6e413cafe2fe2a24). Separately from this fix, I think formal verification and modeling could be useful for parser work in Ghostty. The model is written in FizzBee, which uses a Python-like Starlark syntax and is fairly readable. If that seems useful, I’d be happy to open a separate discussion about whether something like that belongs in the repository as executable documentation or an additional safety net for future parser changes.
4 months ago
PageList.zig
lib-vt: add pwd_changed callback for OSC 7/9/1337 Previously the libghostty-vt stream handler dropped .report_pwd as a no-op, so embedders never saw shell-reported cwd changes and the terminal's pwd field was never populated from escape sequences. Wire the action to setPwd and expose a pwd_changed callback analogous to title_changed via GHOSTTY_TERMINAL_OPT_PWD_CHANGED. The payload is passed through unparsed; embedders read it with ghostty_terminal_get and decode any URI scheme themselves.
2 months ago
Parser.zig
fix(terminal): bounds check params in DCS passthrough entry When a DCS sequence has more than MAX_PARAMS parameters, entering dcs_passthrough would write to params[params_idx] without a bounds check, causing an out-of-bounds access. Drop the entire DCS hook when params overflow, consistent with how csi_dispatch handles it. Found by AFL fuzzing.
5 months ago
Screen.zig
terminal: support click_events=2
2 months ago
ScreenSet.zig
libghostty: add tracked grid ref API Add a C API for tracked pins, known as a tracked grid ref in C. The new API can create tracked refs from terminal points, snapshot them back to regular grid refs for cell access, convert them to coordinates, move them to a new point, report when their semantic location was lost, and free the tracked pin bookkeeping. This is backed by PageList tracked pins and exposed through the libghostty-vt export layer and headers.
2 months ago
Selection.zig
libghostty: add selection ordering APIs Expose selection endpoint ordering through the libghostty-vt C API so embedders can safely normalize selections whose start and end refs may be reversed. The new APIs report the current order and return a fresh untracked selection with forward or reverse bounds. Selection.Order now uses lib.Enum, matching the existing adjustment enum pattern and keeping the C ABI enum generated from the same Zig source of truth. The new functions are wired through the C API re-export and lib-vt export paths, with coverage for mirrored rectangular selection ordering.
2 months ago
SelectionGesture.zig
libghostty: fix wasm build for selection gesture
2 months ago
StringMap.zig
terminal: bound link regex search work with Oniguruma retry limits Fixes #11177 Use per-search Oniguruma match params (retry_limit_in_search) in StringMap-backed link detection to avoid pathological backtracking hangs on very long lines. The units are ticks in the internal loop so its kind of opaque but this seems to still match some very long URLs. The test case in question was a 169K character line (which is now rejected).
5 months ago
Tabstops.zig
tripwire: change backing store from ArrayHashMap to EnumMap This eliminates all allocation from Tripwire.
6 months ago
Terminal.zig
fix: fix tests, change enum fields to lowercase
2 months ago
UTF8Decoder.zig
core: use std.testing.expectEqualStrings where appropriate
1 year ago
ansi.zig
terminal: add lib.zig to centralize lib target and re-exports Previously every file in the terminal package independently imported build_options and ../lib/main.zig, then computed the same lib_target constant. This was repetitive and meant each file needed both imports just to get the target. Introduce src/terminal/lib.zig which computes the target once and re-exports the commonly used lib types (Enum, TaggedUnion, Struct, String, checkGhosttyHEnum, structSizedFieldFits). All terminal package files now import lib.zig and use lib.target instead of the local lib_target constant, removing the per-file boilerplate.
4 months ago
apc.zig
terminal: hook up glyph protocol glossary to terminal state This hooks up the glyph protocol glossary to the terminal state. This effectively makes us handle the APC protocol for it both in Ghostty GUI and libghostty, although we didn't implement the renderer yet. The Zig/C libghostty API also has a way to disable the protocol but it is enabled by default. The memory usage is bound by the specification. For dirty tracking for the renderer, we're going with the simple route that any glyph change marks a coarse grained dirty flag and we'll [in the future] rebuild the entire state in the renderer. I think this will be fine for realistic workloads, but we can reassess in the future when we have real workloads.
2 months ago
bitmap_allocator.zig
terminal: add helpers to BitmapAllocator for sizing
6 months ago
build_options.zig
libghostty-vt: add semver pre info to build info
4 months ago
charsets.zig
perf: inline trivial charset lookup
8 months ago
color.zig
vt: expose terminal default colors via C API Add set/get support for foreground, background, cursor, and palette default colors through ghostty_terminal_set and ghostty_terminal_get. Four new set options (COLOR_FOREGROUND, COLOR_BACKGROUND, COLOR_CURSOR, COLOR_PALETTE) write directly to the terminal color defaults. Passing NULL clears the value for RGB colors or resets the palette to the built-in default. All set operations mark the palette dirty flag for the renderer. Eight new get data types retrieve either the effective color (override or default, via DynamicRGB.get) or the default color only (ignoring any OSC overrides). Effective getters for RGB colors return the new NO_VALUE result code when no color is configured. The palette getters return the current or original palette respectively. Adds the GHOSTTY_NO_VALUE result code for cases where a queried value is simply not configured, distinct from GHOSTTY_INVALID_VALUE which indicates a caller error.
4 months ago
csi.zig
terminal: add lib.zig to centralize lib target and re-exports Previously every file in the terminal package independently imported build_options and ../lib/main.zig, then computed the same lib_target constant. This was repetitive and meant each file needed both imports just to get the target. Introduce src/terminal/lib.zig which computes the target once and re-exports the commonly used lib types (Enum, TaggedUnion, Struct, String, checkGhosttyHEnum, structSizedFieldFits). All terminal package files now import lib.zig and use lib.target instead of the local lib_target constant, removing the per-file boilerplate.
4 months ago
cursor.zig
start extracting core terminal zig module
10 months ago
dcs.zig
terminal: move tmux into folder
8 months ago
device_attributes.zig
terminal: add lib.zig to centralize lib target and re-exports Previously every file in the terminal package independently imported build_options and ../lib/main.zig, then computed the same lib_target constant. This was repetitive and meant each file needed both imports just to get the target. Introduce src/terminal/lib.zig which computes the target once and re-exports the commonly used lib types (Enum, TaggedUnion, Struct, String, checkGhosttyHEnum, structSizedFieldFits). All terminal package files now import lib.zig and use lib.target instead of the local lib_target constant, removing the per-file boilerplate.
4 months ago
device_status.zig
terminal: add lib.zig to centralize lib target and re-exports Previously every file in the terminal package independently imported build_options and ../lib/main.zig, then computed the same lib_target constant. This was repetitive and meant each file needed both imports just to get the target. Introduce src/terminal/lib.zig which computes the target once and re-exports the commonly used lib types (Enum, TaggedUnion, Struct, String, checkGhosttyHEnum, structSizedFieldFits). All terminal package files now import lib.zig and use lib.target instead of the local lib_target constant, removing the per-file boilerplate.
4 months ago
focus.zig
terminal: add lib.zig to centralize lib target and re-exports Previously every file in the terminal package independently imported build_options and ../lib/main.zig, then computed the same lib_target constant. This was repetitive and meant each file needed both imports just to get the target. Introduce src/terminal/lib.zig which computes the target once and re-exports the commonly used lib types (Enum, TaggedUnion, Struct, String, checkGhosttyHEnum, structSizedFieldFits). All terminal package files now import lib.zig and use lib.target instead of the local lib_target constant, removing the per-file boilerplate.
4 months ago
formatter.zig
terminal: add lib.zig to centralize lib target and re-exports Previously every file in the terminal package independently imported build_options and ../lib/main.zig, then computed the same lib_target constant. This was repetitive and meant each file needed both imports just to get the target. Introduce src/terminal/lib.zig which computes the target once and re-exports the commonly used lib types (Enum, TaggedUnion, Struct, String, checkGhosttyHEnum, structSizedFieldFits). All terminal package files now import lib.zig and use lib.target instead of the local lib_target constant, removing the per-file boilerplate.
4 months ago
hash_map.zig
Lots of duplicate word typos + typo.
5 months ago
highlight.zig
terminal/search: screen search prunes history for no-scrollback screens The big comment in `search/screen.zig` describes the solution well. The problem is that our search is discrete by page and a page can contain some amount of history as well. For zero-scrollback screens, we need to fully prune any history lines. For everyone else, everything in the PageList is scrollable and visible so we should search it.
7 months ago
hyperlink.zig
terminal: more strict sizing for page capacities, max cap can fit 64-bit
7 months ago
kitty.zig
terminal: support disabling kitty graphics protocol
10 months ago
lib.zig
libghostty: add utf-8 grapheme cell getter to C API Add a render-state row-cells getter that encodes the current cell's full grapheme cluster directly as UTF-8 into a caller-provided GhosttyBuffer. The getter writes the base codepoint first, followed by any extra grapheme codepoints, and follows the existing buffer-writer convention where len is bytes written on success or required capacity on GHOSTTY_OUT_OF_SPACE. Previously C consumers could query grapheme codepoints, but bindings that needed UTF-8 text had to reconstruct and encode the cluster themselves. That duplicated terminal internals in downstream bindings and made users pay for awkward cross-language struct handling. By owning the UTF-8/grapheme behavior in libghostty, bindings can use one stable C API and optionally wrap it with small binding-local helpers.
2 months ago
main.zig
terminal: SelectionGesture, but only with mouse press
2 months ago
modes.zig
core: implement backarrow key mode (DECBKM) - mode 67 This mode allows programs to modify the code that the `backspace` key (backarrow key in DEC parlance) sends. If this mode is `off`/`false`/`reset` (the default, the same as before this PR), we send the byte `0x7f`. If this mode is `on`/`true`/`set` we send the byte `0x08`.
4 months ago
mouse.zig
terminal: add lib.zig to centralize lib target and re-exports Previously every file in the terminal package independently imported build_options and ../lib/main.zig, then computed the same lib_target constant. This was repetitive and meant each file needed both imports just to get the target. Introduce src/terminal/lib.zig which computes the target once and re-exports the commonly used lib types (Enum, TaggedUnion, Struct, String, checkGhosttyHEnum, structSizedFieldFits). All terminal package files now import lib.zig and use lib.target instead of the local lib_target constant, removing the per-file boilerplate.
4 months ago
osc.zig
terminal: redo trailing state capture in OSC parser Trailing state capture now is encapsulated in a struct `Capture` and all parsers access the data via `p.capture.trailing()` rather than directly from the writer. This is primarily to prep for the OSC parser to be able to capture the entire sequence (not just the trailing part) so we can setup libghostty for fallback handlers so libghostty implementers can have custom OSC behaviors. But, it has the benefit of making our OSC parser much cleaner too.
4 months ago
page.zig
terminal: support VirtualAlloc for page allocation on windows Extract the platform-specific page backing memory allocation into AllocPosix and AllocWindows structs behind a PageAlloc comptime switch. Previously, POSIX mmap calls were inlined at each call site. This adds a Windows VirtualAlloc implementation and routes all allocation through PageAlloc.alloc/free, making the backing memory strategy consistent and easier to extend.
4 months ago
parse_table.zig
Remove unused imports
8 months ago
point.zig
libghostty: add tracked grid ref API Add a C API for tracked pins, known as a tracked grid ref in C. The new API can create tracked refs from terminal points, snapshot them back to regular grid refs for cell access, convert them to coordinates, move them to a new point, report when their semantic location was lost, and free the tracked pin bookkeeping. This is backed by PageList tracked pins and exposed through the libghostty-vt export layer and headers.
2 months ago
ref_counted_set.zig
terminal: page.exactRowCapacity
6 months ago
render.zig
terminal: add lib.zig to centralize lib target and re-exports Previously every file in the terminal package independently imported build_options and ../lib/main.zig, then computed the same lib_target constant. This was repetitive and meant each file needed both imports just to get the target. Introduce src/terminal/lib.zig which computes the target once and re-exports the commonly used lib types (Enum, TaggedUnion, Struct, String, checkGhosttyHEnum, structSizedFieldFits). All terminal package files now import lib.zig and use lib.target instead of the local lib_target constant, removing the per-file boilerplate.
4 months ago
search.zig
terminal: switch search to use flattened highlights
8 months ago
selection_codepoints.zig
libghostty: selection word/line/output/all helpers
2 months ago
sgr.zig
terminal: add lib.zig to centralize lib target and re-exports Previously every file in the terminal package independently imported build_options and ../lib/main.zig, then computed the same lib_target constant. This was repetitive and meant each file needed both imports just to get the target. Introduce src/terminal/lib.zig which computes the target once and re-exports the commonly used lib types (Enum, TaggedUnion, Struct, String, checkGhosttyHEnum, structSizedFieldFits). All terminal package files now import lib.zig and use lib.target instead of the local lib_target constant, removing the per-file boilerplate.
4 months ago
size.zig
terminal: more strict sizing for page capacities, max cap can fit 64-bit
7 months ago
size_report.zig
terminal: add lib.zig to centralize lib target and re-exports Previously every file in the terminal package independently imported build_options and ../lib/main.zig, then computed the same lib_target constant. This was repetitive and meant each file needed both imports just to get the target. Introduce src/terminal/lib.zig which computes the target once and re-exports the commonly used lib types (Enum, TaggedUnion, Struct, String, checkGhosttyHEnum, structSizedFieldFits). All terminal package files now import lib.zig and use lib.target instead of the local lib_target constant, removing the per-file boilerplate.
4 months ago
stream.zig
terminal: add lib.zig to centralize lib target and re-exports Previously every file in the terminal package independently imported build_options and ../lib/main.zig, then computed the same lib_target constant. This was repetitive and meant each file needed both imports just to get the target. Introduce src/terminal/lib.zig which computes the target once and re-exports the commonly used lib types (Enum, TaggedUnion, Struct, String, checkGhosttyHEnum, structSizedFieldFits). All terminal package files now import lib.zig and use lib.target instead of the local lib_target constant, removing the per-file boilerplate.
4 months ago
stream_terminal.zig
lib-vt: add pwd_changed callback for OSC 7/9/1337 Previously the libghostty-vt stream handler dropped .report_pwd as a no-op, so embedders never saw shell-reported cwd changes and the terminal's pwd field was never populated from escape sequences. Wire the action to setPwd and expose a pwd_changed callback analogous to title_changed via GHOSTTY_TERMINAL_OPT_PWD_CHANGED. The payload is passed through unparsed; embedders read it with ghostty_terminal_get and decode any URI scheme themselves.
2 months ago
style.zig
libghostty: add resolved bg_color and fg_color to cells API Fixes #11705 Add bg_color and fg_color options to GhosttyRenderStateRowCellsData that resolve the final RGB color for a cell, flattening the multiple possible sources. For background, this handles content-tag bg_color_rgb, content-tag bg_color_palette (looked up in the palette), and the style bg_color. For foreground, this resolves palette indices through the palette; bold color handling is not applied and is left to the caller. Both return GHOSTTY_INVALID_VALUE when no explicit color is set, in which case the caller should fall back to whatever default color it wants (e.g. the terminal background/foreground).
4 months ago
sys.zig
terminal: make wuffs runtime-swappable, enable Kitty graphics for libvt Introduce terminal/sys.zig which provides runtime-swappable function pointers for operations that depend on external implementations. This allows embedders of the terminal package to swap out implementations at startup without hard dependencies on specific libraries. The first function exposed is decode_png, which defaults to a wuffs implementation. The kitty graphics image loader now calls through sys.decode_png instead of importing wuffs directly. This allows us to enable Kitty graphics support in libghostty-vt for all targets except wasm32-freestanding.
4 months ago
tmux.zig
terminal/tmux: start viewer state machine
8 months ago
x11_color.zig
terminal: handle CRLF line endings in rgb.txt parsing The X11 color map parser in x11_color.zig uses @embedFile to load rgb.txt at comptime, then splits on \n. On Windows, git may check out rgb.txt with CRLF line endings, leaving a trailing \r on each line. This caused color names to be stored as e.g. "white\r" instead of "white", so all X11 color lookups failed at runtime. Strip trailing \r from each line before parsing. Also mark rgb.txt as -text in .gitattributes to prevent line ending conversion in future checkouts.
4 months ago