Skip to content

Commit

Permalink
fix: truncate textinput placeholder (charmbracelet#442)
Browse files Browse the repository at this point in the history
Co-authored-by: Sean Banko <seanbanko@Seans-MacBook-Air.local>
  • Loading branch information
2 people authored and maaslalani committed Feb 28, 2024
1 parent 1ea8504 commit ff19ee1
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 ff19ee1

Please sign in to comment.