diff options
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/src/lib.rs | 4 | ||||
-rw-r--r-- | helix-core/src/line_ending.rs | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index 35124069..55365500 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -110,5 +110,7 @@ pub use syntax::Syntax; pub use diagnostic::Diagnostic; pub use state::State; -pub use line_ending::{auto_detect_line_ending, LineEnding, DEFAULT_LINE_ENDING}; +pub use line_ending::{ + auto_detect_line_ending, rope_slice_to_line_ending, LineEnding, DEFAULT_LINE_ENDING, +}; pub use transaction::{Assoc, Change, ChangeSet, Operation, Transaction}; diff --git a/helix-core/src/line_ending.rs b/helix-core/src/line_ending.rs index 47420f9e..4f5708ec 100644 --- a/helix-core/src/line_ending.rs +++ b/helix-core/src/line_ending.rs @@ -31,6 +31,9 @@ pub fn str_to_line_ending(g: &str) -> Option<LineEnding> { "\u{000D}" => Some(LineEnding::CR), "\u{0085}" => Some(LineEnding::Nel), "\u{2028}" => Some(LineEnding::LS), + "\u{000B}" => Some(LineEnding::VT), + "\u{000C}" => Some(LineEnding::FF), + "\u{2029}" => Some(LineEnding::PS), // Not a line ending _ => None, } @@ -58,7 +61,10 @@ pub fn auto_detect_line_ending(doc: &Rope) -> Option<LineEnding> { _ => None, }; if ending.is_some() { - return ending; + match ending { + Some(LineEnding::VT) | Some(LineEnding::FF) | Some(LineEnding::PS) => {} + _ => return ending, + } } } ending |