setCursor moves the cursor to the given position and returns whether or not the cursor blink should be reset. If the position is out of bounds the cursor will be moved to the start or end accordingly.
(pos int)
| 215 | // the cursor blink should be reset. If the position is out of bounds the |
| 216 | // cursor will be moved to the start or end accordingly. |
| 217 | func (m *TextInputModel) setCursor(pos int) bool { |
| 218 | m.pos = Clamp(pos, 0, len(m.value)) |
| 219 | m.handleOverflow() |
| 220 | |
| 221 | // Show the cursor unless it's been explicitly hidden |
| 222 | m.blink = m.cursorMode == CursorHide |
| 223 | |
| 224 | // Reset cursor blink if necessary |
| 225 | return m.cursorMode == CursorBlink |
| 226 | } |
| 227 | |
| 228 | // CursorStart moves the cursor to the start of the input field. |
| 229 | func (m *TextInputModel) CursorStart() { |
no test coverage detected