Skip to content

Commit

Permalink
ConEmu fixes - we cannot go to 24-bit mode on that yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamore committed Mar 2, 2024
1 parent cd0fe98 commit f6c43a3
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions console_win.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,22 @@ func (s *cScreen) Init() error {

s.truecolor = true

// ConEmu handling of colors and scrolling when in terminal
// mode is extremely problematic at the best. The color
// palette will scroll even though characters do not, when
// emitting stuff for the last character. In the future we
// might change this to look at specific versions of ConEmu
// if they fix the bug.
// ConEmu handling of colors and scrolling when in VT output mode is extremely poor.
// The color palette will scroll even though characters do not, when
// emitting stuff for the last character. In the future we might change this to
// look at specific versions of ConEmu if they fix the bug.
// We can also try disabling auto margin mode.
tryVt := true
if os.Getenv("ConEmuPID") != "" {
s.truecolor = false
tryVt = false
}
switch os.Getenv("TCELL_TRUECOLOR") {
case "disable":
s.truecolor = false
case "enable":
s.truecolor = true
tryVt = true
}

s.Lock()
Expand All @@ -229,7 +231,13 @@ func (s *cScreen) Init() error {
// 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" {
switch os.Getenv("TCELL_VTMODE") {
case "disable":
tryVt = false
case "enable":
tryVt = true
}
if tryVt {
s.setOutMode(modeVtOutput | modeNoAutoNL | modeCookedOut | modeUnderline)
var om uint32
s.getOutMode(&om)
Expand Down

0 comments on commit f6c43a3

Please sign in to comment.