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 · 5 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

@beberlei
Copy link

beberlei commented Nov 3, 2024

I have the same with a symfony/console based output, in my case "composer install":

termshot -- composer require cweagans/composer-patches:2.0.0-beta2 --no-scripts --no-ansi -n

leading to crash:

github.com/gonvenience/bunt.ParseStream.func6(...)
        github.com/gonvenience/[email protected]/parse.go:191
github.com/gonvenience/bunt.ParseStream({0x103303958?, 0x1400014ecc0?}, {0x0, 0x0, 0x1400038a808?})
        github.com/gonvenience/[email protected]/parse.go:234 +0x66c
github.com/homeport/termshot/internal/img.(*Scaffold).AddContent(0x14000163aa8, {0x103303958?, 0x1400014ecc0?})
        github.com/homeport/termshot/internal/img/output.go:118 +0x3c
github.com/homeport/termshot/internal/cmd.init.func1(0x1035da620, {0x1400012a240, 0x5, 0x6})
        github.com/homeport/termshot/internal/cmd/root.go:120 +0x450
github.com/spf13/cobra.(*Command).execute(0x1035da620, {0x14000136010, 0x6, 0x6})
        github.com/spf13/[email protected]/command.go:985 +0x834
github.com/spf13/cobra.(*Command).ExecuteC(0x1035da620)
        github.com/spf13/[email protected]/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/[email protected]/command.go:1041
github.com/homeport/termshot/internal/cmd.Execute()
        github.com/homeport/termshot/internal/cmd/root.go:161 +0x58
main.main()
        ./main.go:26 +0x1c

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

3 participants