summaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/document.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index 704094a6..bd5f8012 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -6,9 +6,9 @@ use std::sync::Arc;
use helix_core::{
chars::{char_is_linebreak, char_is_whitespace},
- auto_detect_line_ending, DEFAULT_LINE_ENDING, history::History,
syntax::{LanguageConfiguration, LOADER},
ChangeSet, Diagnostic, LineEnding, Rope, Selection, State, Syntax, Transaction,
+ DEFAULT_LINE_ENDING,
};
use crate::{DocumentId, ViewId};
@@ -740,6 +740,20 @@ impl Document {
pub fn set_diagnostics(&mut self, diagnostics: Vec<Diagnostic>) {
self.diagnostics = diagnostics;
}
+
+ pub fn line_ending(&self) -> &str {
+ match self.line_ending {
+ LineEnding::Crlf => "\u{000D}\u{000A}",
+ LineEnding::LF => "\u{000A}",
+ LineEnding::Nel => "\u{0085}",
+ LineEnding::LS => "\u{2028}",
+ LineEnding::CR => "\u{000D}",
+ _ => panic!(
+ "Unexpected line ending: {:?}, expected Crlf, LF, CR, Nel, or LS.",
+ self.line_ending
+ ),
+ }
+ }
}
#[cfg(test)]