diff options
author | Nathan Vegdahl | 2021-06-21 18:22:07 +0000 |
---|---|---|
committer | Nathan Vegdahl | 2021-06-21 18:22:07 +0000 |
commit | e436c30ed7df303a32455c4cf9e0574ab87c0683 (patch) | |
tree | f324bb18d1d3c7a3916d568ca32b793e4a96e672 /helix-term | |
parent | 23d618853553afbac78c8d2a4ad048195f3484b8 (diff) |
Make split_selection_on_newline command handle all line endings.
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/commands.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 7f60f2f9..dc7f8913 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -791,7 +791,8 @@ fn split_selection_on_newline(cx: &mut Context) { let text = doc.text().slice(..); // only compile the regex once #[allow(clippy::trivial_regex)] - static REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"\n").unwrap()); + static REGEX: Lazy<Regex> = + Lazy::new(|| Regex::new(r"\r\n|[\n\r\u{000B}\u{000C}\u{0085}\u{2028}\u{2029}]").unwrap()); let selection = selection::split_on_matches(text, doc.selection(view.id), ®EX); doc.set_selection(view.id, selection); } |