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
seanbanko and Sean Banko authored Dec 22, 2023
1 parent 15ea7f3 commit 9a0ff2b
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 9a0ff2b

Please sign in to comment.