mirror of
https://github.com/Maks1mS/bubbles.git
synced 2024-12-23 14:22:58 +03:00
fix: set value moves cursor only when empty and at starting position
This commit is contained in:
parent
e857875f2a
commit
d177512114
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user