diff --git a/textinput/textinput.go b/textinput/textinput.go index 363089b2..86b3a682 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -745,8 +745,14 @@ func (m Model) placeholderView() string { render = styles.Placeholder.Render ) - p := make([]rune, m.Width()+1) - copy(p, []rune(m.Placeholder)) + var p []rune + rawHolder := []rune(m.Placeholder) + if m.Width() <= 0 { + p = make([]rune, len(rawHolder)) + } else { + p = make([]rune, m.Width() + 1) + } + copy(p, rawHolder) m.virtualCursor.TextStyle = styles.Placeholder m.virtualCursor.SetChar(string(p[:1]))