fix(ui): cursor mispositioned when pasting large blocks of text in textarea (#2113)

Ayman Bagabas created

Change summary

internal/ui/model/ui.go | 5 +++++
1 file changed, 5 insertions(+)

Detailed changes

internal/ui/model/ui.go 🔗

@@ -684,8 +684,13 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 			cmds = append(cmds, cmd)
 		}
 	case openEditorMsg:
+		var cmd tea.Cmd
 		m.textarea.SetValue(msg.Text)
 		m.textarea.MoveToEnd()
+		m.textarea, cmd = m.textarea.Update(msg)
+		if cmd != nil {
+			cmds = append(cmds, cmd)
+		}
 	case uiutil.InfoMsg:
 		m.status.SetInfoMsg(msg)
 		ttl := msg.TTL