aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorNathan Vegdahl2021-06-21 17:29:29 +0000
committerNathan Vegdahl2021-06-21 17:29:29 +0000
commit07e28802f6b61a17e839d05b2a031575f323b9c9 (patch)
treecf28b772ad9b43a125a27dc3018ac09ba1bb2e16 /helix-term/src
parent714002048cc9601bf0981435c6d3ad43d1c765e8 (diff)
Add function to get the line ending of a str slice.
This is needed in some places.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 70441fcf..3d2a9028 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1,6 +1,7 @@
use helix_core::{
- comment, coords_at_pos, find_first_non_whitespace_char, find_root, get_line_ending, graphemes,
- indent, line_end_char_index, match_brackets,
+ comment, coords_at_pos, find_first_non_whitespace_char, find_root, graphemes, indent,
+ line_ending::{get_line_ending, get_line_ending_of_str, line_end_char_index},
+ match_brackets,
movement::{self, Direction},
object, pos_at_coords,
regex::{self, Regex},
@@ -2534,10 +2535,10 @@ fn paste_impl(
.unwrap(),
);
- // if any of values ends \n it's linewise paste
+ // if any of values ends with a line ending, it's linewise paste
let linewise = values
.iter()
- .any(|value| value.ends_with(doc.line_ending.as_str()));
+ .any(|value| get_line_ending_of_str(value).is_some());
let mut values = values.iter().cloned().map(Tendril::from).chain(repeat);