Repository navigation
cmdio: turn on VT processing for Windows consoles at startup - #8240
Merged
Merged
Conversation
A classic Windows console window (conhost) starts programs with ENABLE_VIRTUAL_TERMINAL_PROCESSING off, so escape sequences print as text. lipgloss v1 turned the bit on the first time it rendered a style; lipgloss v2 leaves it to the caller. Turn it on for stdout and stderr in cmdio.NewIO, only where it is missing, so styled output renders the same with either version. Windows Terminal and other ConPTY hosts already start programs with it on. This is temporary: Bubble Tea sets the mode for the duration of a program, so it can go once all styled output is drawn by Bubble Tea. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Contributor
Author
pietern
enabled auto-merge
December 1, 2026 10:29
Collaborator
✅ Integration test reportCommit: cd68bb2
Top 3 slowest tests (at least 2 minutes):
|
simonfaltum
reviewed
Dec 1, 2026
simonfaltum
left a comment
Member
There was a problem hiding this comment.
I found no code correctness blocker in this change. The targeted cmdio tests and Windows/macOS vet checks pass, and CI is green.
[nit] The repo's changelog rules require a fragment for a user-visible fix. The description lists raw-ANSI fixes that also affect main, but cd68bb2ab explicitly removes the fragment. Could you restore a short .nextchanges/cli/ entry, or note the intended release-note exception for this prerequisite?
Non-blocking design question: is NewIO the intended owner of this process-wide console setup, rather than root.initializeIO? The current production callers look safe; this is about making the lifetime of the temporary side effect clear.
simonfaltum
approved these changes
Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Changes
cmdio.NewIOturns onENABLE_VIRTUAL_TERMINAL_PROCESSINGfor stdout and stderr when they are Windows consoles and the bit is off (libs/cmdio/vt_windows.go; a no-op elsewhere). It never restores the mode.This is temporary. Bubble Tea sets the mode when a program starts and restores it when the program exits, so output drawn by a program doesn't need it. It can be removed once all styled output goes through Bubble Tea, which may take a while.
Why
We found this while comparing the Charm v2 swap (#7742) against v1 in real terminals. In PowerShell in a classic console window (conhost),
selftest tui colors --lipglossrendered its swatches on v1 and printed←[48;2;…mon v2. The same applies to any lipgloss output written outside a Bubble Tea program, such asdatabricks air get.How each layer turns VT processing on. All of them call
GetConsoleMode, thenSetConsoleModewith the bit added:EnableWindowsANSIConsole)Render, once per processEnableLegacyWindowsANSI)cmdio.NewIOSo v2 drops the only VT enable we had outside Bubble Tea. v1 had gaps of its own, which this also fixes on
main:cmdio.Redand the rest) write raw SGR codes without lipgloss, so they printed as←[31mon conhost unless a lipgloss render had happened earlier in the process.maincan't show it.Measured console modes for a child process: conhost
0x0003(VT off); Windows Terminal and Git Bash with ConPTY0x0007(VT on). So the change does nothing outside conhost.Landing this before the Charm v2 stack keeps its comparison free of this difference.
Tests
go test ./libs/cmdio/...; vet for windows, darwin and linux; golangci-lint (0 issues) for darwin and windows.This pull request and its description were written by Isaac.