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

panic: move cursor value is out of bounds after any command with ANSI escape sequences #177

Open
5HT2 opened this issue Nov 21, 2023 · 4 comments

Comments

@5HT2
Copy link

5HT2 commented Nov 21, 2023

I get the following panic when trying to use termshot -- pfetch and termshot -- "./simple-go-cli-program", the latter just prints plain text, it's a tiny go program I wrote to test.

I think this has to do with color handling in my terminal? Though, I'm not sure why my Go program (only using log.Printf) would have any color escapes in the output.

panic: move cursor value is out of bounds

goroutine 1 [running]:
github.com/gonvenience/bunt.ParseStream.func4()
	github.com/gonvenience/[email protected]/parse.go:144 +0x1a8
github.com/gonvenience/bunt.ParseStream({0x102456738?, 0x1400016ac00?}, {0x0, 0x0, 0x1400033f000?})
	github.com/gonvenience/[email protected]/parse.go:225 +0x3b0
github.com/homeport/termshot/internal/img.(*Scaffold).AddContent(0x14000123bb8, {0x102456738?, 0x1400016ac00?})
	github.com/homeport/termshot/internal/img/output.go:118 +0x3c
github.com/homeport/termshot/internal/cmd.glob..func1(0x1026eca80?, {0x1400016aba0?, 0x1, 0x3})
	github.com/homeport/termshot/internal/cmd/root.go:120 +0x39c
github.com/spf13/cobra.(*Command).execute(0x1026eca80, {0x14000132050, 0x3, 0x3})
	github.com/spf13/[email protected]/command.go:940 +0x5c8
github.com/spf13/cobra.(*Command).ExecuteC(0x1026eca80)
	github.com/spf13/[email protected]/command.go:1068 +0x35c
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/[email protected]/command.go:992
github.com/homeport/termshot/internal/cmd.Execute()
	github.com/homeport/termshot/internal/cmd/root.go:162 +0x64
main.main()
	./main.go:26 +0x1c

Using the following answer from StackoverFlow with pfetch does indeed work as expected, though without and color or formatting.

Terminal info:
out

If there's any other info I can help provide, please let me know.

@5HT2 5HT2 changed the title panic: `` after any normal command panic: move cursor value is out of bounds after any command with ANSI escape sequences Nov 21, 2023
@5HT2
Copy link
Author

5HT2 commented Nov 21, 2023

Okay I can't repro the issue with my Go CLI program anymore, idk what's up, pfetch does still reproduce this every time.

@filol
Copy link

filol commented Dec 8, 2023

I have the same error :

Saving session...completed.
panic: move cursor value is out of bounds

goroutine 1 [running]:
github.com/gonvenience/bunt.ParseStream.func4()
	github.com/gonvenience/[email protected]/parse.go:144 +0x1a8
github.com/gonvenience/bunt.ParseStream({0x1047ba738?, 0x140000e8ba0?}, {0x0, 0x0, 0x140002d7000?})
	github.com/gonvenience/[email protected]/parse.go:225 +0x3b0
github.com/homeport/termshot/internal/img.(*Scaffold).AddContent(0x140000abbb8, {0x1047ba738?, 0x140000e8ba0?})
	github.com/homeport/termshot/internal/img/output.go:118 +0x3c
github.com/homeport/termshot/internal/cmd.glob..func1(0x104a50a80?, {0x14000099470?, 0x1, 0x1})
	github.com/homeport/termshot/internal/cmd/root.go:120 +0x39c
github.com/spf13/cobra.(*Command).execute(0x104a50a80, {0x140000be010, 0x1, 0x1})
	github.com/spf13/[email protected]/command.go:940 +0x5c8
github.com/spf13/cobra.(*Command).ExecuteC(0x104a50a80)
	github.com/spf13/[email protected]/command.go:1068 +0x35c
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/[email protected]/command.go:992
github.com/homeport/termshot/internal/cmd.Execute()
	github.com/homeport/termshot/internal/cmd/root.go:162 +0x64
main.main()
	./main.go:26 +0x1c

@filol
Copy link

filol commented Dec 8, 2023

It's working with bash but not with zsh.

Update : updating oh my zsh fixed the problem

@5HT2
Copy link
Author

5HT2 commented Dec 22, 2023

I don't have oh my zsh at all. my entire zshrc: https://cdn.frogg.ie/paste-1703274290.txt
cmds and env are just defined functions that don't interact with anything else

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

2 participants