Skip to content

Commit

Permalink
fix: truncate textinput placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Banko authored and Sean Banko committed Nov 25, 2023
1 parent 167e906 commit 2fb36b8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion textinput/textinput.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 2fb36b8

Please sign in to comment.