mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-10-10 06:11:22 +03:00
fix: set value moves cursor only when empty and at starting position
This commit is contained in:
@@ -122,6 +122,7 @@ func (m *Model) SetValue(s string) {
|
||||
}
|
||||
}
|
||||
|
||||
empty := len(m.value) == 0
|
||||
m.Err = nil
|
||||
|
||||
runes := []rune(s)
|
||||
@@ -130,7 +131,7 @@ func (m *Model) SetValue(s string) {
|
||||
} else {
|
||||
m.value = runes
|
||||
}
|
||||
if m.pos > len(m.value) {
|
||||
if (m.pos == 0 && empty) || m.pos > len(m.value) {
|
||||
m.SetCursor(len(m.value))
|
||||
}
|
||||
m.handleOverflow()
|
||||
|
Reference in New Issue
Block a user