charmbracelet / charmbracelet/bubbletea

Cursor remains visible in Windows' cmd.exe using WithAltScreen

Open
#1,454 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
44.9k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

This was already somewhat discussed and solved here https://github.com/charmbracelet/bubbletea/issues/190 in 2022, but I noticed this problem today with the old Windows standard cmd.exe terminal when resizing. Even if I do

```go
func(m model) Update(msg tea.Msg)(tea.Model, tea.Cmd) {
switch msg: = msg.(type) {
case tea.WindowSizeMsg:
return m, tea.HideCursor
}
}
```

it doesn't disappeared. When introducing a delay like this

```go
func(m model) Update(msg tea.Msg)(tea.Model, tea.Cmd) {

switch msg: = msg.(type) {
case tea.WindowSizeMsg:
return m, tea.Tick(200 * time.Millisecond, func(t time.Time) tea.Msg {
return customHideCursorMsg {}
})

case customHideCursorMsg:
return m, tea.HideCursor
}
}

type customHideCursorMsg struct {}
```

the cursor is hidden as expected. Is it possible that in the first code tea.HideCursor is executed before the resizing is "complete", i.e. it is set too early, which can be circumvented by inserting a delay?

Standard cmd.exe of Windows 22H2 and Bubbletea v1.3.6.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in Windows 22H2 cmd.exe with Bubble Tea v1.3.6, WithAltScreen, and a tea.WindowSizeMsg handler that returns tea.HideCursor immediately. Compare that behavior with the delayed customHideCursorMsg example during terminal resizing. Done means the cursor is reliably hidden after resizing without requiring an arbitrary delay.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.