Open MikaelFangel opened 2 months ago
Describe the bug When you increase the width above 31 and the placeholder capacity is set to 32, the program panics. This bug is causing the bug reported here https://github.com/charmbracelet/gum/issues/591 as far as I can tell.
To Reproduce Steps to reproduce the behavior:
ti.Width
Source Code
package main import ( "fmt" "log" "github.com/charmbracelet/bubbles/textinput" tea "github.com/charmbracelet/bubbletea" ) func main() { p := tea.NewProgram(initialModel()) if _, err := p.Run(); err != nil { log.Fatal(err) } } type model struct { textInput textinput.Model err error } func initialModel() model { ti := textinput.New() ti.Placeholder = "作業ディレクトリを指定してください" ti.Width = 32 return model{ textInput: ti, err: nil, } } func (m model) Init() tea.Cmd { return textinput.Blink } func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, nil } func (m model) View() string { return fmt.Sprintf( m.textInput.View(), ) + "\n" }
Expected behavior The placeholder capacity should not cause out-of-bounds panics based on the ti.Width.
Screenshots p getting a default capacity of 32
p
The minWidth exceeds the capacity
minWidth
The out-of-bounds slide happening
Describe the bug When you increase the width above 31 and the placeholder capacity is set to 32, the program panics. This bug is causing the bug reported here https://github.com/charmbracelet/gum/issues/591 as far as I can tell.
To Reproduce Steps to reproduce the behavior:
ti.Width
of 31Source Code
Expected behavior The placeholder capacity should not cause out-of-bounds panics based on the
ti.Width
.Screenshots![20240530_11h39m01s_grim](https://github.com/charmbracelet/bubbles/assets/34864484/3db9fac7-8384-48ba-ac68-561bad4a18ca)
p
getting a default capacity of 32The![20240530_11h40m06s_grim](https://github.com/charmbracelet/bubbles/assets/34864484/0f995c60-fb96-4ea9-8fc3-1f553bbb566f)
minWidth
exceeds the capacityThe out-of-bounds slide happening![20240530_11h41m16s_grim](https://github.com/charmbracelet/bubbles/assets/34864484/cac552d7-04a3-4f5d-ba43-21fd1160c1d1)