mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00: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:
@@ -138,6 +138,10 @@ func (m Model) Mode() Mode {
|
|||||||
//
|
//
|
||||||
// For available cursor modes, see type CursorMode.
|
// For available cursor modes, see type CursorMode.
|
||||||
func (m *Model) SetMode(mode Mode) tea.Cmd {
|
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.mode = mode
|
||||||
m.Blink = m.mode == CursorHide || !m.focus
|
m.Blink = m.mode == CursorHide || !m.focus
|
||||||
if mode == CursorBlink {
|
if mode == CursorBlink {
|
||||||
|
|||||||
Reference in New Issue
Block a user