Skip to content

feat(tui): warn when a raster-font console cannot display Unicode - #287

Merged
quickbeard merged 2 commits into
mainfrom
conhost-warning
Aug 24, 2026
Merged

quickbeard merged 2 commits into
mainfrom
conhost-warning

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

Problem

Windows users running CoDev Code in a legacy console window (classic conhost, e.g. a plain "Windows PowerShell" window) with a raster font reported Vietnamese text showing "font errors": characters outside the OEM code page render as ? (lỗi → l?i), with best-fit substitutions for some letters (đ → d, ư → u). This happens at conhost's draw time — raster fonts can only display OEM code page characters (chcp docs, SetConsoleOutputCP remarks) — so both the user's prompt and the model's response look corrupted even though the app writes correct UTF-8 and the underlying data is fine. The app cannot fix the rendering; today it corrupts silently and users blame the app or the model.

Change

  • packages/tui/src/terminal-win32.ts: new win32RasterFontConsole() export using kernel32 GetCurrentConsoleFontEx through the existing dlopen table. Returns true only when stdout is a win32 TTY, none of WT_SESSION/TERM_PROGRAM/TERM are set (conhost sets none of these; Windows Terminal, VS Code, mintty, and ssh sessions each set one, so modern hosts that render Unicode fine are skipped regardless of the font they report), and the current console font lacks TMPF_TRUETYPE.
  • packages/tui/src/app.tsx: an onMount beside the other startup toasts shows a one-shot warning when the check fires, telling the user to run CoDev Code in Windows Terminal or switch the console font to a TrueType font such as Consolas.
  • DIVERGENCES.md: row for both upstream-file edits.

Testing

  • bun typecheck in packages/tui passes.
  • bun test in packages/tui: 265 pass, 1 skip, 0 fail.
  • The FFI path needs a real legacy conhost with a raster font to fire; on non-win32 and on modern hosts the function short-circuits to false before touching FFI.

🤖 Generated with Claude Code

Quickbeard and others added 2 commits August 24, 2026 09:50
Legacy conhost windows using a raster font can only draw OEM code page
characters: the display best-fit converts everything else to "?" at draw
time, so Vietnamese/CJK text looks corrupted even though the underlying
data is correct. Detect that configuration at startup (win32 TTY, no
WT_SESSION/TERM_PROGRAM/TERM, console font without TMPF_TRUETYPE) and
show a one-shot warning toast pointing users at Windows Terminal or a
TrueType console font.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@quickbeard
quickbeard merged commit eef8be9 into main Aug 24, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the conhost-warning branch August 24, 2026 02:51
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.

1 participant