mirror of
https://github.com/charmbracelet/bubbles.git
synced 2026-07-22 11:39:28 -06:00
fix: Bug: SetMode method in cursor library does not handle invalid mode values correctly (#477)
* fix cursor SetMode * adjust the mode value
This commit is contained in:
parent
1029f3164d
commit
e27ec01b6e
@ -138,6 +138,10 @@ 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 value is out of range
|
||||
if mode < CursorBlink || mode > CursorHide {
|
||||
return nil
|
||||
}
|
||||
m.mode = mode
|
||||
m.Blink = m.mode == CursorHide || !m.focus
|
||||
if mode == CursorBlink {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user