Skip to content

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

@fingoltin

Description

@fingoltin

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/bubbletea@v0.26.6/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/bubbles@v0.18.0/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/bubbles@v0.18.0/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/bubbles@v0.18.0/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/bubbletea@v0.26.6/tea.go:414 +0x6ee
github.com/charmbracelet/bubbletea.(*Program).Run(0x9891280)
	/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.26.6/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/cobra@v1.8.1/command.go:985 +0xaa0
github.com/spf13/cobra.(*Command).ExecuteC(0x992c188)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x458
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/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

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