gum
gum copied to clipboard
Setting `GUM_CHOOSE_HEIGHT=0` causes `integer divide by zero` error
Describe the bug
Running gum choose op1 op2, with GUM_CHOOSE_HEIGHT=0 causes integer divide by zero error
panic: runtime error: integer divide by zero
goroutine 1 [running]:
github.com/charmbracelet/gum/choose.Options.Run({{0xc0000fea60, 0x2, 0x2}, 0x1, 0x0, 0x0, 0x0, {0xc0006660a0, 0x2}, 0x1, ...})
/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/choose/command.go:109 +0x147f
reflect.Value.call({0x9e3e60?, 0xc00063e810?, 0xc000701490?}, {0x9f299b, 0x4}, {0xc0002916b0, 0x0, 0xc000291608?})
/opt/hostedtoolcache/go/1.23.5/x64/src/reflect/value.go:581 +0xca6
reflect.Value.Call({0x9e3e60?, 0xc00063e810?, 0x1b?}, {0xc0002916b0?, 0x46949d?, 0x0?})
/opt/hostedtoolcache/go/1.23.5/x64/src/reflect/value.go:365 +0xb9
github.com/alecthomas/kong.callAnyFunction({0x9e3e60?, 0xc00063e810?, 0x98c6a0?}, 0xc00074e420)
/home/runner/go/pkg/mod/github.com/alecthomas/[email protected]/callbacks.go:139 +0x690
github.com/alecthomas/kong.callFunction({0x9e3e60?, 0xc00063e810?, 0xc000291ae0?}, 0xc00074e420)
/home/runner/go/pkg/mod/github.com/alecthomas/[email protected]/callbacks.go:106 +0x17b
github.com/alecthomas/kong.(*Context).RunNode(0xc00052a080, 0xc00047bc20, {0x0, 0x0, 0x58e975?})
/home/runner/go/pkg/mod/github.com/alecthomas/[email protected]/context.go:807 +0x849
github.com/alecthomas/kong.(*Context).Run(0xc00052a080, {0x0?, 0xc0004eded8?, 0xd?})
/home/runner/go/pkg/mod/github.com/alecthomas/[email protected]/context.go:836 +0x13d
main.main()
To Reproduce Steps to reproduce the behavior:
- export GUM_CHOOSE_HEIGHT=0
- gum choose op1 op2
Expected behavior
Command would execute successfully
Desktop (please complete the following information):
- OS: 6.10.14-linuxkit
- gum version v0.15.2
More context This error did not happen on an older version (0.14.5)