charmbracelet / charmbracelet/bubbles

Make `cursor.blinkCanceled` public so that it can be handled

Open
#834 5 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
8.9k
Forks
457
Avg merge
1d 18h
Merged PRs (30d)
5

Description

**Is your feature request related to a problem? Please describe.**
I'm writing a `tea.Model` that wraps around a `bubbles.textinput` and a few other bubbles.
In my `Update` method, I have a switch statement on the `msg.(type)`, in which I handle certain messages I send myself but forward for instance `tea.KeyMsg` to the inner `textinput`. I want to include a default case to that switch statement that panics, so that I ensure I don't accidentally forgot to handle a message type while developing.

Now the issue occurs when the inner `textinput` is Focus'd, because then `cursor.blinkCanceled` messages sometimes pass through the `Update` chain, which triggers the panic I have.
This wouldn't be a problem if I could simply have `case cursor.blinkCanceled:`, but since `blinkCanceled` is local to the cursor package the compiler won't let me catch it.

**Describe the solution you'd like**
`type cursor.blinkCanceled...` -> `type cursor.BlinkCanceled...` so that the type is exposed to the outside.

**Describe alternatives you've considered**
For now I've disabled blinking altogether on the inner `textinput`, but that feels like a shame!

**Additional context**

**Update:**
Actually, setting `input.Cursor.Blink = false` doesn't appear to prevent the `blinkCanceled` messages from being fired. Would there be another way to prevent these messages from being fired?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.