@@ -3462,7 +3462,14 @@ fn paste_impl(
34623462 .iter()
34633463 .any(|value| get_line_ending_of_str(value).is_some());
34643464
3465− let mut values = values.iter().cloned().map(Tendril::from).chain(repeat);
3465+ // Only compiled once.
3466+ #[allow(clippy::trivial_regex)]
3467+ static REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"\r\n|\r|\n").unwrap());
3468+ let mut values = values
3469+ .iter()
3470+ .map(|value| REGEX.replace_all(value, doc.line_ending.as_str()))
3471+ .map(|value| Tendril::from(value.as_ref()))
3472+ .chain(repeat);
34663473
34673474 let text = doc.text();
34683475 let selection = doc.selection(view.id);