placeholderView returns the prompt and placeholder view, if any.
()
| 727 | |
| 728 | // placeholderView returns the prompt and placeholder view, if any. |
| 729 | func (m TextInputModel) placeholderView() string { |
| 730 | var ( |
| 731 | v string |
| 732 | p = m.Placeholder |
| 733 | style = m.PlaceholderStyle.Inline(true).Render |
| 734 | ) |
| 735 | |
| 736 | // Cursor |
| 737 | if m.blink { |
| 738 | v += m.cursorView(style(p[:1])) |
| 739 | } else { |
| 740 | v += m.cursorView(p[:1]) |
| 741 | } |
| 742 | |
| 743 | // The rest of the placeholder text |
| 744 | v += style(p[1:]) |
| 745 | |
| 746 | return m.PromptStyle.Render(m.Prompt) + v |
| 747 | } |
| 748 | |
| 749 | // cursorView styles the cursor. |
| 750 | func (m TextInputModel) cursorView(v string) string { |
no test coverage detected