blinkCmd is an internal command used to manage cursor blinking.
()
| 761 | |
| 762 | // blinkCmd is an internal command used to manage cursor blinking. |
| 763 | func (m *TextInputModel) blinkCmd() tea.Cmd { |
| 764 | if m.cursorMode != CursorBlink { |
| 765 | return nil |
| 766 | } |
| 767 | |
| 768 | if m.blinkCtx != nil && m.blinkCtx.cancel != nil { |
| 769 | m.blinkCtx.cancel() |
| 770 | } |
| 771 | |
| 772 | ctx, cancel := context.WithTimeout(m.blinkCtx.ctx, m.BlinkSpeed) |
| 773 | m.blinkCtx.cancel = cancel |
| 774 | |
| 775 | m.blinkTag++ |
| 776 | |
| 777 | return func() tea.Msg { |
| 778 | defer cancel() |
| 779 | <-ctx.Done() |
| 780 | if ctx.Err() == context.DeadlineExceeded { |
| 781 | return blinkMsg{id: m.id, tag: m.blinkTag} |
| 782 | } |
| 783 | return blinkCanceled{} |
| 784 | } |
| 785 | } |
| 786 | |
| 787 | // Blink is a command used to initialize cursor blinking. |
| 788 | func Blink() tea.Msg { |
no outgoing calls
no test coverage detected