Skip to content

Commit

Permalink
feat: add tea.ShowCursor, complementing tea.HideCursor
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Oct 4, 2022
1 parent e4ca150 commit eab831d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down
3 changes: 3 additions & 0 deletions tea.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ func (p *Program) StartReturningModel() (Model, error) {
p.renderer.disableMouseCellMotion()
p.renderer.disableMouseAllMotion()

case showCursorMsg:
p.renderer.showCursor()

case hideCursorMsg:
p.renderer.hideCursor()

Expand Down

0 comments on commit eab831d

Please sign in to comment.