SetValue sets the value of the text input.
(s string)
| 183 | |
| 184 | // SetValue sets the value of the text input. |
| 185 | func (m *TextInputModel) SetValue(s string) { |
| 186 | runes := []rune(s) |
| 187 | if m.CharLimit > 0 && len(runes) > m.CharLimit { |
| 188 | m.value = runes[:m.CharLimit] |
| 189 | } else { |
| 190 | m.value = runes |
| 191 | } |
| 192 | if m.pos == 0 || m.pos > len(m.value) { |
| 193 | m.setCursor(len(m.value)) |
| 194 | } |
| 195 | m.handleOverflow() |
| 196 | } |
| 197 | |
| 198 | // Value returns the value of the text input. |
| 199 | func (m TextInputModel) Value() string { |
no test coverage detected