Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No output in VS Code debug console because Width/Height detected as -1 #30

Open
fxkr opened this issue May 30, 2020 · 1 comment
Open

Comments

@fxkr
Copy link

fxkr commented May 30, 2020

package main

import (
	"github.com/buger/goterm"
)

func main() {
	println("before")
	goterm.Println("foo")
	goterm.Flush()
	println("after", goterm.Width(), goterm.Height())
}

Works if I start the program manually in a regular VS Code terminal (or any terminal really):

image

Doesnt work if I run it via a VS Code launch config, where the output will go into the VS Code debug console. Notice Width/Height is -1, and the text printed by goterm is missing

image

The root cause is that goterm limits its output to the detected Width/Height,

My expectation would be for goterm to handle -1/-1 by disabling row/col limits.

@fxkr
Copy link
Author

fxkr commented May 30, 2020

I realized my use case (redraw the screen with new data every 1 sec) is so simple I don't really need goterm. So I switched to just printing the clear screen escape code and then the data. In the debug console, all the screens will appear in sequence which is acceptable when debugging. In a real terminal, I get the single fullscreen of data behavior I want.

I noticed the VS code debug terminal doesn't seem to support escape codes at all. For my usecase, disabling row/col limits would have worked. I am not entirely sure if that would be the right behavior for goterm. Not ideal, but better than no output at all? I'll leave this issue open for awareness that -1/-1 can happen. I won't object if you just close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant