From 4da03b3c338a04dd67ca192209419d8b3279caed Mon Sep 17 00:00:00 2001 From: RoomWithOutRoof Date: Wed, 15 Apr 2026 00:12:10 +0800 Subject: [PATCH 1/2] fix textinput: render full placeholder text Previously, the placeholder would only display the first character when Width() was small or unset. This was caused by allocating a rune slice with size m.Width()+1, which would truncate the placeholder text. Now we allocate the full placeholder text and display it properly regardless of the Width() setting. Fixes charmbracelet/bubbles#779 --- textinput/textinput.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/textinput/textinput.go b/textinput/textinput.go index 363089b2..a195e696 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -745,8 +745,7 @@ func (m Model) placeholderView() string { render = styles.Placeholder.Render ) - p := make([]rune, m.Width()+1) - copy(p, []rune(m.Placeholder)) + p := []rune(m.Placeholder) m.virtualCursor.TextStyle = styles.Placeholder m.virtualCursor.SetChar(string(p[:1])) From bccf7031d3d581bae70b451a726fac02f12c2bfd Mon Sep 17 00:00:00 2001 From: RoomWithOutRoof Date: Wed, 15 Apr 2026 04:06:38 +0800 Subject: [PATCH 2/2] fix(textinput): allow full placeholder display when width is 0 The early return check incorrectly truncated the placeholder to only 1 character when Width was 0. Since the comment states 'if there is no width, the placeholder can be any length', we should always show the full placeholder when Width is 0. This removes the erroneous early return that was causing only the first character of the placeholder to be visible. --- textinput/textinput.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/textinput/textinput.go b/textinput/textinput.go index a195e696..5fa67e41 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -751,11 +751,6 @@ func (m Model) placeholderView() string { m.virtualCursor.SetChar(string(p[:1])) v += m.virtualCursor.View() - // If the entire placeholder is already set and no padding is needed, finish - if m.Width() < 1 && len(p) <= 1 { - return styles.Prompt.Render(m.Prompt) + v - } - // If Width is set then size placeholder accordingly if m.Width() > 0 { // available width is width - len + cursor offset of 1