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

Adding tasks with prefix of length 8, 9, and other random lengths causes a panic #28

Closed
LJNIC opened this issue Aug 11, 2024 · 3 comments · Fixed by #29
Closed

Adding tasks with prefix of length 8, 9, and other random lengths causes a panic #28

LJNIC opened this issue Aug 11, 2024 · 3 comments · Fixed by #29

Comments

@LJNIC
Copy link

LJNIC commented Aug 11, 2024

Describe the bug
Adding a task with a prefix of 8 or 9 causes a panic. From further testing some longer lengths like 49 also cause a panic.

Setup
Please complete the following information along with version numbers, if applicable.

  • omm 0.5.0
  • Fedora 40
  • same behaviour with zsh, fish, and bash
  • kitty
  • no multiplexer
  • en_US.UTF-8

To Reproduce
Steps to reproduce the behavior:

  1. Add a task with length 9.
  2. Panic

Expected behavior
No panic.

Screenshots
This is from length 49 but it's always a similar error, just a different index.

Caught panic:

runtime error: index out of range [-59]

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
	/opt/hostedtoolcache/go/1.22.5/x64/src/runtime/debug/stack.go:24 +0x83
runtime/debug.PrintStack()
	/opt/hostedtoolcache/go/1.22.5/x64/src/runtime/debug/stack.go:16 +0x1a
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:479 +0xbc
panic({0x87f8240, 0xa1e67f0})
	/opt/hostedtoolcache/go/1.22.5/x64/src/runtime/panic.go:770 +0x103
github.com/dhth/omm/internal/types.GetDynamicStyle({0x9bfa000, 0x31})
	/home/runner/work/omm/omm/internal/types/types.go:142 +0x109
github.com/dhth/omm/internal/types.Task.Description({{0x0, 0x0}, 0x35, {0x9bfa000, 0x40}, 0x0, 0x1, {0xc1a61e1098453737, 0x3dc1649e2c, 0x9464040}, ...})
	/home/runner/work/omm/omm/internal/types/types.go:108 +0x86
github.com/charmbracelet/bubbles/list.DefaultDelegate.Render({0x1, {{0x94640c0, 0xf0400, {0x0, 0x0}, 0x0, {0x8fe3b5c, 0x9aca7b0}, {0x0, 0x0}, ...}, ...}, ...}, ...)
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/list/defaultitem.go:147 +0x97
github.com/charmbracelet/bubbles/list.Model.populatedView({0x1, 0x1, 0x1, 0x1, 0x0, 0x1, {0x882689e, 0x4}, {0x8827ab7, 0x5}, ...})
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/list/list.go:1185 +0x2f0
github.com/charmbracelet/bubbles/list.Model.View({0x1, 0x1, 0x1, 0x1, 0x0, 0x1, {0x882689e, 0x4}, {0x8827ab7, 0x5}, ...})
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/list/list.go:1036 +0x47f
github.com/dhth/omm/internal/ui.model.View({0x987cc88, {0x1, {0x882b9c4, 0x7}, {0x882b9cb, 0x7}, {0x0, 0x0}, {0xffa061c7, 0x4}, ...}, ...})
	/home/runner/work/omm/omm/internal/ui/view.go:49 +0x10e8
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0x9891280, {0x8fe44b0, 0x9c4a000}, 0x9bce480)
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:414 +0x6ee
github.com/charmbracelet/bubbletea.(*Program).Run(0x9891280)
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:550 +0xa9d
github.com/dhth/omm/internal/ui.RenderUI(0x987cc88, {0x1, {0x882b9c4, 0x7}, {0x882b9cb, 0x7}, {0x0, 0x0}, {0xffa061c7, 0x4}, ...})
	/home/runner/work/omm/omm/internal/ui/ui.go:24 +0x244
github.com/dhth/omm/cmd.NewRootCommand.func2(0x992c188, {0x98e2840, 0x0, 0x5})
	/home/runner/work/omm/omm/cmd/root.go:254 +0x37c
github.com/spf13/cobra.(*Command).execute(0x992c188, {0x981a068, 0x5, 0x5})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0xaa0
github.com/spf13/cobra.(*Command).ExecuteC(0x992c188)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x458
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041
github.com/dhth/omm/cmd.Execute({0x8fe1264, 0x5})
	/home/runner/work/omm/omm/cmd/root.go:62 +0xd4
main.main()
	/home/runner/work/omm/omm/main.go:20 +0x68
@dhth
Copy link
Owner

dhth commented Aug 11, 2024

Hi. Thanks for the report.
Could you check if the change pushed on this branch fixes things? Thanks.

@dhth
Copy link
Owner

dhth commented Aug 12, 2024

Forgot to mention, asking you to verify this since I can't seem to reproduce this on my machine (mac arm64).

On native mac:
image

In a docker container running arm64 linux:
image

In a docker container running amd64 linux:
image

@LJNIC
Copy link
Author

LJNIC commented Aug 12, 2024

Yep, works on that branch!

@dhth dhth closed this as completed in #29 Aug 12, 2024
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

Successfully merging a pull request may close this issue.

2 participants