Skip to content

Commit

Permalink
fix(textinput): set cursor on initial value
Browse files Browse the repository at this point in the history
This reverts the code back to the logic from 4ce16e8 which fixed the
issue of the cursor not being moved when an initial value was set with
SetValue.

The fix regressed in 16053f4.
  • Loading branch information
GabrielNagy authored and maaslalani committed Jul 5, 2022
1 parent 7cc5786 commit 588393f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion textinput/textinput.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (m *Model) SetValue(s string) {
} else {
m.value = runes
}
if (m.pos == 0 && len(m.value) == 0) || m.pos > len(m.value) {
if m.pos == 0 || m.pos > len(m.value) {
m.setCursor(len(m.value))
}
m.handleOverflow()
Expand Down

0 comments on commit 588393f

Please sign in to comment.