From ff19ee10aac5a4f314e1b798c986f431321b66fb Mon Sep 17 00:00:00 2001 From: Sean Banko <74473367+seanbanko@users.noreply.github.com> Date: Thu, 21 Dec 2023 20:14:53 -0800 Subject: [PATCH] fix: truncate textinput placeholder (#442) Co-authored-by: Sean Banko --- textinput/textinput.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/textinput/textinput.go b/textinput/textinput.go index 964d28f1..55e63dfd 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -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 }