fix: truncate textinput placeholder (#442)

Co-authored-by: Sean Banko <seanbanko@Seans-MacBook-Air.local>
This commit is contained in:
Sean Banko
2023-12-21 23:14:53 -05:00
committed by GitHub
co-authored by Sean Banko
parent 15ea7f3754
commit 9a0ff2ba4d
+5 -1
View File
@@ -714,7 +714,11 @@ func (m Model) placeholderView() string {
v += m.Cursor.View()
// The rest of the placeholder text
v += style(string(p[1:]))
var spaces []rune
for i := 0; i < m.Width-lipgloss.Width(string(p[1:m.Width])); i++ {
spaces = append(spaces, ' ')
}
v += style(string(append(p[1:m.Width], spaces...)))
return m.PromptStyle.Render(m.Prompt) + v
}