feat: add tea.ShowCursor, complementing tea.HideCursor

This commit is contained in:
Christian Muehlhaeuser
2022-10-04 05:28:52 +02:00
parent 8d6bdcf2fd
commit 37b79f55f1
2 changed files with 13 additions and 0 deletions

View File

@@ -92,6 +92,16 @@ func HideCursor() Msg {
// this message with HideCursor.
type hideCursorMsg struct{}
// ShowCursor is a special command for manually instructing Bubble Tea to show
// the cursor.
func ShowCursor() Msg {
return showCursorMsg{}
}
// showCursorMsg is an internal command used to show the cursor. You can send
// this message with ShowCursor.
type showCursorMsg struct{}
// EnterAltScreen enters the alternate screen buffer, which consumes the entire
// terminal window. ExitAltScreen will return the terminal to its former state.
//

3
tea.go
View File

@@ -394,6 +394,9 @@ func (p *Program) StartReturningModel() (Model, error) {
p.renderer.disableMouseCellMotion()
p.renderer.disableMouseAllMotion()
case showCursorMsg:
p.renderer.showCursor()
case hideCursorMsg:
p.renderer.hideCursor()