Skip to content

Commit

Permalink
fix cursor SetMode
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhaCodes committed Feb 8, 2024
1 parent eed309f commit bf63b6a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cursor/cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ func (m Model) Mode() Mode {
//
// For available cursor modes, see type CursorMode.
func (m *Model) SetMode(mode Mode) tea.Cmd {
// Adjust the mode value if it's less than 0.
if mode < CursorBlink {
mode = CursorBlink
}
// Adjust the mode value if it's greater than 2.
if mode > CursorHide {
mode = CursorHide
}
m.mode = mode
m.Blink = m.mode == CursorHide || !m.focus
if mode == CursorBlink {
Expand Down

0 comments on commit bf63b6a

Please sign in to comment.