What is libghostty?
“libghostty is a portable, high-performance C library for terminal emulation, extracted directly from the core of Ghostty.”
A terminal looks simple: a window with text in it. Under the window there are two jobs. The first job is to understand what a program prints. Programs do not just print letters. They mix in escape codes, which are short hidden commands that say things like "move the cursor up two lines" or "print the next word in green". The second job is to draw the result on the screen.
The first job is the hard one. There are hundreds of escape codes from decades of different terminals, and every editor, IDE and web console that shows a terminal has had to write its own code for them, often with bugs. libghostty is Mitchell Hashimoto's answer: take the part of the Ghostty terminal app that does the first job, and ship it as a library anyone can use.
The library that reached 1.0 is called libghostty-vt (vt is short for virtual terminal). It is written in Zig, but it exposes a plain C interface, so almost any language can call it. The post lists community bindings for Rust, Go, JavaScript, Swift, Python, .NET, Elixir, Dart and Java.


