Terminal.Emulation
0.1.0
See the version list below for details.
dotnet add package Terminal.Emulation --version 0.1.0
NuGet\Install-Package Terminal.Emulation -Version 0.1.0
<PackageReference Include="Terminal.Emulation" Version="0.1.0" />
<PackageVersion Include="Terminal.Emulation" Version="0.1.0" />
<PackageReference Include="Terminal.Emulation" />
paket add Terminal.Emulation --version 0.1.0
#r "nuget: Terminal.Emulation, 0.1.0"
#:package Terminal.Emulation@0.1.0
#addin nuget:?package=Terminal.Emulation&version=0.1.0
#tool nuget:?package=Terminal.Emulation&version=0.1.0
Terminal.Avalonia
A lightweight, fast terminal-emulator control for Avalonia (.NET 10), built from scratch — not a wrapper around an existing emulator. Designed to host any terminal program (PowerShell, bash, …) and full-screen dynamic TUI apps (claude code, opencode, vim, htop).
Drop as many TerminalControl instances as you like into one app — each owns its own emulator
engine and child process, so they run independently and resize with their layout slot.
Why from scratch
Generic terminal controls fail on real TUIs because they skip the query/response sequences — the app hangs waiting for a reply. This project implements the full contract that makes TUIs work:
- Response channel — DA (
ESC[c), DSR/CPR (ESC[6n), DECRQM — apps that ask get answered. - VT500 parser — canonical DEC ANSI state machine (Paul Williams), robust to split/garbled input.
- Alternate screen (
?1049h), truecolor (38;2;r;g;b) + 256-color, Unicode width (CJK/emoji = 2 cells, combining marks = 0), deferred autowrap, scroll regions, ICH/DCH/IL/DL/ECH, synchronized output, bracketed paste, SGR mouse reporting. - PTY backends — native ConPTY on Windows,
forkptyon Linux/macOS.
Layout
| Project | Role |
|---|---|
src/Terminal.Emulation |
Pure-C# engine: VT parser + screen/scrollback buffer. No UI, fully unit-tested. |
src/Terminal.Pty |
Pseudo-terminal backends (ConPTY + Unix forkpty). |
src/Terminal.Avalonia |
The TerminalControl: rendering, keyboard/mouse, clipboard, scrollbar. |
samples/Terminal.Avalonia.Demo |
Three resizable terminals in splitters. |
tests/Terminal.Emulation.Tests |
Engine + ConPTY smoke tests. |
Install
dotnet add package Terminal.Avalonia
Three packages, always released together on one version number:
| Package | Take it when |
|---|---|
Terminal.Avalonia |
You want the control. Pulls the other two. |
Terminal.Pty |
You want ConPTY/forkpty behind one interface, with no UI. |
Terminal.Emulation |
You want the VT engine alone — parsing a recorded session, testing, a renderer of your own. |
On Windows, Terminal.Pty also lays conpty/<arch>/{conpty.dll,OpenConsole.exe} into your output and
publish directories and runs sessions on that host rather than the in-box conhost.exe, which crashes
on some TUI teardowns and takes the shell with it. Nothing to configure; IPtyConnection.HostDescription
says which host a session actually got. To lay the files out yourself, set
<TerminalPtyDeployConsoleHost>false</TerminalPtyDeployConsoleHost>.
Usage
var term = new TerminalControl { FontSize = 14 };
myGrid.Children.Add(term);
term.Start(new PtyOptions
{
Command = OperatingSystem.IsWindows() ? "powershell.exe" : "/bin/bash",
Columns = 80,
Rows = 24,
});
The control sizes itself to its slot (columns/rows are derived from the font metrics) and forwards resizes to the child via SIGWINCH / ConPTY resize. Dispose (or detach from the visual tree) to kill the child and release the PTY.
Input & interaction
- Full keyboard mapping incl. modifiers, function keys, application-cursor mode.
- Mouse text selection (drag, double-click word, triple-click line) + SGR mouse reporting for TUIs; wheel scrolls history (or is reported to the app).
Ctrl+Shift+C/Ctrl+Shift+Vcopy & paste (bracketed-paste aware);Shift+PageUp/PageDownscroll.- Draggable scrollbar over the scrollback ring.
- Bindable/stylable
FontFamily,FontSize,Palettestyled properties; cursor blinks when focused and shows a hollow block when not.
Roadmap
Prioritized gap analysis versus mature emulators (xterm.js, Windows Terminal, WezTerm, …) lives in
docs/ROADMAP.md.
Build & test
dotnet build Terminal.Avalonia.slnx
dotnet test Terminal.Avalonia.slnx
dotnet run --project samples/Terminal.Avalonia.Demo
build.cmd # build + test + pack into artifacts/
Releasing
python Deploy/publish.py --dry-run # test, pack, stop short of pushing
python Deploy/publish.py # test, bump the patch, build, pack, push all three
The version lives once, in Directory.Build.props. A ProjectReference packs as a PackageReference
pinned to exactly that version, so the three go out together or a consumer resolves an engine its
control was never built against. The API key goes in Deploy/.env (gitignored — copy .env.example).
License
MIT — see LICENSE. Terminal.Pty redistributes the MIT-licensed open-source console host
from microsoft/terminal.
⚠️ Run the demo as a normal GUI app. Under a host whose stdout is redirected to a pipe (
dotnet runcaptured by a tool,dotnet test), a console child can inherit that pipe instead of the pseudo console — a launcher artifact, not a bug in the control.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Terminal.Emulation:
| Package | Downloads |
|---|---|
|
Terminal.Avalonia
A lightweight, from-scratch terminal-emulator control for Avalonia UI. Hosts any shell and full-screen TUI apps (vim, htop, claude code, opencode): rendering, keyboard and mouse, selection and clipboard, scrollback, themes, OSC 8 hyperlinks. Many instances can run side by side — each owns its engine and its child process. On Windows it runs on the bundled open-source console host rather than the in-box conhost.exe. |
GitHub repositories
This package is not used by any popular GitHub repositories.