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

Shell gets stuck when --placeholder in gum input contains Japanese characters #591

Open
btbf opened this issue May 24, 2024 · 0 comments · May be fixed by charmbracelet/bubbles#532
Open

Comments

@btbf
Copy link

btbf commented May 24, 2024

There are two issues observed:

Issue 1
When the following command is executed in the shell, there is no response:

gum input --placeholder "作業ディレクトリを指定してください"

Issue 2
When the following command is executed in the shell and the initial value set in the --value parameter is completely deleted using the backspace key, an error occurs:

gum input --value "${HOME}/cnode" --width=0 --header="作業ディレクトリを作成します。任意のパスを指定可能です。デフォルトの場合はそのままEnterを押して下さい" --header.foreground="99" --placeholder "作業ディレクトリを指定してください"

Error Details

Caught panic:

runtime error: slice bounds out of range [:34] with capacity 32

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
        /opt/hostedtoolcache/go/1.22.2/x64/src/runtime/debug/stack.go:24 +0x5e
runtime/debug.PrintStack()
        /opt/hostedtoolcache/go/1.22.2/x64/src/runtime/debug/stack.go:16 +0x13
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:478 +0x91
panic({0x9f1de0?, 0xc0005e01e0?})
        /opt/hostedtoolcache/go/1.22.2/x64/src/runtime/panic.go:770 +0x132
github.com/charmbracelet/bubbles/textinput.Model.placeholderView({{0x0, 0x0}, {0xc0004f5ab8, 0x2}, {0xc0004de0c0, 0x33}, 0x0, 0x2a, {0x1f972880, {0x0, ...}, ...}, ...})
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/textinput/textinput.go:733 +0x589
github.com/charmbracelet/bubbles/textinput.Model.View({{0x0, 0x0}, {0xc0004f5ab8, 0x2}, {0xc0004de0c0, 0x33}, 0x0, 0x2a, {0x1f972880, {0x0, ...}, ...}, ...})
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/textinput/textinput.go:657 +0x59
github.com/charmbracelet/huh.(*Input).View(0xc00050e808)
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/field_input.go:261 +0x71d
github.com/charmbracelet/huh.(*Group).buildView(0xc0007c4488)
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/group.go:290 +0x395
github.com/charmbracelet/huh.(*Group).Update(0xc0007c4488, {0x9e86c0, 0xc0004e6570})
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/group.go:252 +0x3a5
github.com/charmbracelet/huh.(*Form).Update(0xc000313080, {0x9e86c0, 0xc0004e6570?})
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/form.go:512 +0x58b
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc0000e5520, {0x1abc210?, 0xc000313080?}, 0xc00002e060)
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:411 +0x5e2
github.com/charmbracelet/bubbletea.(*Program).Run(0xc0000e5520)
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:543 +0x86b
github.com/charmbracelet/huh.(*Form).run(0xc00050f801?)
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/form.go:560 +0x37
github.com/charmbracelet/huh.(*Form).Run(0xc0007c4488?)
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/form.go:555 +0x68
github.com/charmbracelet/gum/input.Options.Run({{0xc0004de0c0, 0x33}, {0xc0004f5ab8, 0x2}, {{0x0, 0x0}, {0x0, 0x0}, {0xc0004f5b18, 0x4}, ...}, ...})
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/input/command.go:54 +0x628
reflect.Value.call({0xa01620?, 0xc0000a2fd8?, 0x417d9f?}, {0xa1e7ae, 0x4}, {0xc000809ab8, 0x0, 0x969d0e?})
        /opt/hostedtoolcache/go/1.22.2/x64/src/reflect/value.go:596 +0xca6
reflect.Value.Call({0xa01620?, 0xc0000a2fd8?, 0x9bdc80?}, {0xc000809ab8?, 0x995a40?, 0x0?})
        /opt/hostedtoolcache/go/1.22.2/x64/src/reflect/value.go:380 +0xb9
github.com/alecthomas/kong.callFunction({0xa01620?, 0xc0000a2fd8?, 0xc000809cb0?}, 0xc000702780)
        /home/runner/go/pkg/mod/github.com/alecthomas/[email protected]/callbacks.go:98 +0x45a
github.com/alecthomas/kong.(*Context).RunNode(0xc000258080, 0xc0006421e0, {0x0, 0x0, 0xc000432dc0?})
        /home/runner/go/pkg/mod/github.com/alecthomas/[email protected]/context.go:774 +0x80e
github.com/alecthomas/kong.(*Context).Run(0x987e00?, {0x0?, 0xc000705ee0?, 0x7?})
        /home/runner/go/pkg/mod/github.com/alecthomas/[email protected]/context.go:799 +0x132
main.main()
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/main.go:74 +0x878
panic: interface conversion: tea.Model is nil, not *huh.Form

goroutine 1 [running]:
github.com/charmbracelet/huh.(*Form).run(0xc00050f801?)
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/form.go:561 +0x7b
github.com/charmbracelet/huh.(*Form).Run(0xc0007c4488?)
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/form.go:555 +0x68
github.com/charmbracelet/gum/input.Options.Run({{0xc0004de0c0, 0x33}, {0xc0004f5ab8, 0x2}, {{0x0, 0x0}, {0x0, 0x0}, {0xc0004f5b18, 0x4}, ...}, ...})
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/input/command.go:54 +0x628
reflect.Value.call({0xa01620?, 0xc0000a2fd8?, 0x417d9f?}, {0xa1e7ae, 0x4}, {0xc000809ab8, 0x0, 0x969d0e?})
        /opt/hostedtoolcache/go/1.22.2/x64/src/reflect/value.go:596 +0xca6
reflect.Value.Call({0xa01620?, 0xc0000a2fd8?, 0x9bdc80?}, {0xc000809ab8?, 0x995a40?, 0x0?})
        /opt/hostedtoolcache/go/1.22.2/x64/src/reflect/value.go:380 +0xb9
github.com/alecthomas/kong.callFunction({0xa01620?, 0xc0000a2fd8?, 0xc000809cb0?}, 0xc000702780)
        /home/runner/go/pkg/mod/github.com/alecthomas/[email protected]/callbacks.go:98 +0x45a
github.com/alecthomas/kong.(*Context).RunNode(0xc000258080, 0xc0006421e0, {0x0, 0x0, 0xc000432dc0?})
        /home/runner/go/pkg/mod/github.com/alecthomas/[email protected]/context.go:774 +0x80e
github.com/alecthomas/kong.(*Context).Run(0x987e00?, {0x0?, 0xc000705ee0?, 0x7?})
        /home/runner/go/pkg/mod/github.com/alecthomas/[email protected]/context.go:799 +0x132
main.main()
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/main.go:74 +0x878

OS:Ubuntu22.0
Gum:0.14.0

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.

1 participant