Skip to content

Commit

Permalink
fix(textinput): Don't copy head and tailSrc
Browse files Browse the repository at this point in the history
  • Loading branch information
maaslalani committed Jun 10, 2022
1 parent e3c7681 commit f9749f5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions textinput/textinput.go
Expand Up @@ -191,8 +191,7 @@ var NewModel = New
// Returns an error if validation fails.
func (m *Model) SetValue(s string) error {
if m.Validate != nil {
err := m.Validate(s)
if err != nil {
if err := m.Validate(s); err != nil {
m.Err = err
return err
}
Expand Down Expand Up @@ -342,8 +341,8 @@ func (m *Model) handlePaste(v string) bool {
}

// Stuff before and after the cursor
head := append([]rune{}, m.value[:m.pos]...)
tailSrc := append([]rune{}, m.value[m.pos:]...)
head := m.value[:m.pos]
tailSrc := m.value[m.pos:]
tail := make([]rune, len(tailSrc))
copy(tail, tailSrc)

Expand Down

0 comments on commit f9749f5

Please sign in to comment.