charmbracelet / charmbracelet/bubbles
textinput v2: Cursor changes color of text
- Dominant language
- Go
- Stars
- 8.9k
- Forks
- 457
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 5
Description
**Describe the bug**
This cursor changes the color of the text around it & there is no way to control it.
**Setup**
Please complete the following information along with version numbers, if applicable.
- OS Arch
- Shell zsh
- Terminal Emulator kitty
- Terminal Multiplexer N/A
- Locale en_US.UTF-8
**To Reproduce**
Steps to reproduce the behavior:
1. New textinput model
2. Set different color of text
3. Enable cursor (virtual or not)
4. Blur & focus both produce weird results
**Source Code**
n/a
**Expected behavior**
The text foreground color to remain consistent
**Screenshots**
Focused:
Blurred:
**Additional context**
I believe #892 would fix it - I did a temporary fix for this on my local machine, but that PR is more comprehensive:
```
if pos < len(value) { //nolint:nestif
char := m.echoTransform(string(value[pos]))
// vvvvvv this
m.virtualCursor.TextStyle = styles.Text.Inline(true)
// ^^^^^^ this
m.virtualCursor.SetChar(char)
v += m.virtualCursor.View()
```
Contributor guide
Assessment
This issue has not been assessed yet.