Skip to content

fix: ConPTY stdio leak, profile font CSS, xterm cell seams#16

Merged
AThraen merged 3 commits into
mainfrom
fix/conpty-handles-and-fonts
May 10, 2026
Merged

fix: ConPTY stdio leak, profile font CSS, xterm cell seams#16
AThraen merged 3 commits into
mainfrom
fix/conpty-handles-and-fonts

Conversation

@martin-ottosen
Copy link
Copy Markdown
Contributor

What changed

  • ConPTY stdio leak: detach the WPF app from any inherited std handles / console at startup. When launched from a parent that gives us redirected handles (e.g. dotnet run, bash background tasks), ConPTY children were inheriting those handles and writing to the launching shell instead of the PTY pipe — leaving xterm with no output and broken input.
  • Profile font face quoting: Windows Terminal stores font faces as bare names like 0xProto Nerd Font. xterm.js drops the value straight into CSS font-family, where unquoted names with spaces fail to resolve. Quote the value (and append , monospace) both at import time and when applying overrides, so existing saved sessions render correctly without re-import.
  • Cell seams on block characters: enable xterm's customGlyphs so box-drawing/block characters render with built-in glyphs that tile flush across cells.

Testing

  • Launch the app from dotnet run (or any console parent). Create a session — terminal should print and accept input.
  • Open a session that uses a Windows Terminal profile with a multi-word font face. Confirm the configured font is rendering, not the default Cascadia.
  • Run something that draws box characters (e.g. tree, claude's welcome card). Confirm no thin seams between adjacent solid blocks.
  • Existing sessions in state.json (with unquoted ProfileFontFamily) should pick up the correct font without manual re-import.

Developer notes

  • The stdio detach uses FreeConsole + SetStdHandle(..., IntPtr.Zero). FreeConsole alone isn't enough — when the parent hands us pipe handles (not a console), only clearing the std handle slots prevents inheritance.
  • customGlyphs only covers the box-drawing/block Unicode ranges. Nerd Font Private Use Area glyphs still seam in the DOM renderer; the proper fix for those is a canvas/webgl renderer addon, which would require pulling in a new asset. Not done here.
  • Font face normalization is applied both at import (WindowsTerminalProfileService.QuoteFontFace) and at apply time (TerminalBridge.QuoteFontFamily) so saved sessions don't need to be re-imported to benefit.

@AThraen AThraen changed the base branch from feat/wt-profiles to main May 10, 2026 18:57
@AThraen AThraen merged commit 978a7e4 into main May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants