From cd0fe984d90cf553213160f4449881fdf78a1fe5 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 2 Mar 2024 11:31:16 -0800 Subject: [PATCH] Windows: enable VT mode output by default The special environment variable TCELL_VTMODE may be set to "disable" to return to legacy console mode. (This environment variable may be removed in the future, if we determine it is no longer useful.) --- console_win.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/console_win.go b/console_win.go index 66ab4938..6b1642de 100644 --- a/console_win.go +++ b/console_win.go @@ -182,7 +182,6 @@ func (s *cScreen) Init() error { s.eventQ = make(chan Event, 10) s.quit = make(chan struct{}) s.scandone = make(chan struct{}) - in, e := syscall.Open("CONIN$", syscall.O_RDWR, 0) if e != nil { return e @@ -227,9 +226,10 @@ func (s *cScreen) Init() error { s.fini = false s.setInMode(modeResizeEn | modeExtendFlg) - // 24-bit color is opt-in for now, because we can't figure out - // to make it work consistently. - if s.truecolor { + // If a user needs to force old style console, they may do so + // by setting TCELL_VTMODE to disable. This is an undocumented safety net for now. + // It may be removed in the future. (This mostly exists because of ConEmu.) + if os.Getenv("TCELL_VTMODE") != "disable" { s.setOutMode(modeVtOutput | modeNoAutoNL | modeCookedOut | modeUnderline) var om uint32 s.getOutMode(&om)