这是indexloc提供的服务,不要输入任何密码
Skip to content

clearLines not working #11

@coryb

Description

@coryb

Hi Greg,

I was playing with uilive and am having troubles, not sure if it is my terminal or somethings else is wrong, perhaps you have an idea.

Basically when I run go run ./example/main.go I end up with:

$ go run ./example/main.go
Finished: Downloaded 100GB50) GB

So the previous output is not actually getting cleared, despite the \033[2K CSI code being printed and I still see the 50) GB from the "Downloading" prints.

Oddly the \033[J code (clear to end of screen) seems to work, so when I change clearLines to look like this it works fine:

func (w *Writer) clearLines() {
    fmt.Fprint(w.Out, strings.Repeat("\033[A", w.lineCount), "\033[J")
}

I am running on OSX Sierra, but I tried in iterm2 and terminal both with and without tmux and I get the same results with the original code.

Any ideas? Thanks!
-Cory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions