on master help sign in
Make split_selection_on_newline command handle all line endings.
commite436c30ed7df303a32455c4cf9e0574ab87c0683 authorNathan Vegdahl <cessen@cessen.com> dateMon 21 Jun 2021, 11:22 (5 years ago) parent23d6188
1 file changed+2−1
helix-term/src/commands.rs+2−1
helix-term/src/commands.rs+2−1
@@ -791,7 +791,8 @@ fn split_selection_on_newline(cx: &mut Context) {
791791 let text = doc.text().slice(..);
792792 // only compile the regex once
793793 #[allow(clippy::trivial_regex)]
794− static REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"\n").unwrap());
794+ static REGEX: Lazy<Regex> =
795+ Lazy::new(|| Regex::new(r"\r\n|[\n\r\u{000B}\u{000C}\u{0085}\u{2028}\u{2029}]").unwrap());
795796 let selection = selection::split_on_matches(text, doc.selection(view.id), &REGEX);
796797 doc.set_selection(view.id, selection);
797798}