charmbracelet/bubbles

styled placeholders

Opened this issue · 2 comments

m.input.SetValue(lipgloss.NewStyle().
Background(lipgloss.Color("#00ff00")).
Render("hah"))

image
Instead of using textinput.Model.TextStyle to style the whole text, one may want to only style certain words for example.

I think it might be in styleText because escape sequences are being applied to a lipgloss styled string.

  • OS [Arch]
  • Shell [zsh, fish]
  • Terminal Emulator [Alacritty]

Thanks for the issue! So as a baseline, we should definitely strip ansi from placeholders. Then the question becomes: should we allow placeholders to be styled as well? I think so.

Yeah I guess if PlaceholderStyle and TextStyle are deprecated, if one wants a style for the whole string - m.ti.Placeholder = style.Render(text) or

func (m model) View() string {
	v := style.Render(m.ti.Value())
        m.ti.SetValue(v)
	return m.ti.View()
}