Skip to content

Commit 4da03b3

Browse files
author
RoomWithOutRoof
committed
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 #779
1 parent 42130e8 commit 4da03b3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

textinput/textinput.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,7 @@ func (m Model) placeholderView() string {
745745
render = styles.Placeholder.Render
746746
)
747747

748-
p := make([]rune, m.Width()+1)
749-
copy(p, []rune(m.Placeholder))
748+
p := []rune(m.Placeholder)
750749

751750
m.virtualCursor.TextStyle = styles.Placeholder
752751
m.virtualCursor.SetChar(string(p[:1]))

0 commit comments

Comments
 (0)