fix(paste): normalize windows newlines

Kieran Klukas created

Change summary

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

Detailed changes

internal/ui/model/ui.go 🔗

@@ -3462,6 +3462,9 @@ func (m *UI) newSession() tea.Cmd {
 
 // handlePasteMsg handles a paste message.
 func (m *UI) handlePasteMsg(msg tea.PasteMsg) tea.Cmd {
+	// Normalize \r\n before the textarea sanitizer sees it.
+	msg.Content = strings.ReplaceAll(msg.Content, "\r\n", "\n")
+
 	if m.dialog.HasDialogs() {
 		return m.handleDialogMsg(msg)
 	}