Skip to content

Commit

Permalink
adjust the mode value
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhaCodes committed Feb 28, 2024
1 parent bf63b6a commit 6c14fc2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions cursor/cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,9 @@ 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
// Adjust the mode value if it's value is out of range
if mode < CursorBlink || mode > CursorHide {
return nil
}
m.mode = mode
m.Blink = m.mode == CursorHide || !m.focus
Expand Down

0 comments on commit 6c14fc2

Please sign in to comment.