fatih / color

Color package for Go (golang)
https://pkg.go.dev/github.com/fatih/color
MIT License
7.3k stars 615 forks source link

Background color overflows on terminal scroll #135

Closed frax closed 3 years ago

frax commented 3 years ago

And by overflow I mean expands the full line. Is there anyway I can avoid this?

TERM=xterm-256color and I have tried in both iTerm and Terminal, bash and zsh. Latest macOS Big Sur and go 1.16.3. bash behaves a little different but still kinda the same bug.

Here's a simple example, run it a few times from the terminal.

import (
    "github.com/fatih/color"
)

func main() {
    c := color.New(color.FgCyan).Add(color.BgRed)
    c.Println("meep")
    c.Println("meep")
    c.Println("meep")
    c.Println("meep")
}

Screenshot 2021-04-11 at 18 04 37

fatih commented 3 years ago

Hi @frax

I'm not sure what the proper fix would be here. I'm using Tmux and Fish, and for me, it doesn't do it. I think it might be related to your Terminal settings.

Another suggestion would be to use c.Print() instead of c.Println().