summaryrefslogtreecommitdiff
path: root/helix-core/src/line_ending.rs
diff options
context:
space:
mode:
authorIvan Tham2022-02-07 15:37:09 +0000
committerBlaž Hrastnik2022-04-02 15:46:53 +0000
commit8b02bf2ea8c07926697ad8e1e01d77596a540d59 (patch)
treec05a6d37077ff414c972ca2f3b5b34c7d171446a /helix-core/src/line_ending.rs
parente4561d1ddede65baaaf04adf5baa0edbaf8f8028 (diff)
Add (prev) paragraph motion
Also improved testing facility. Fix #1580
Diffstat (limited to 'helix-core/src/line_ending.rs')
-rw-r--r--helix-core/src/line_ending.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/helix-core/src/line_ending.rs b/helix-core/src/line_ending.rs
index 06ec2a45..f0cf3b10 100644
--- a/helix-core/src/line_ending.rs
+++ b/helix-core/src/line_ending.rs
@@ -119,6 +119,11 @@ pub fn str_is_line_ending(s: &str) -> bool {
LineEnding::from_str(s).is_some()
}
+#[inline]
+pub fn rope_is_line_ending(r: RopeSlice) -> bool {
+ r.chunks().all(str_is_line_ending)
+}
+
/// Attempts to detect what line ending the passed document uses.
pub fn auto_detect_line_ending(doc: &Rope) -> Option<LineEnding> {
// Return first matched line ending. Not all possible line endings