@@ -5,14 +5,10 @@ use std::path::{Component, Path, PathBuf};
55use std::sync::Arc;
66
77use helix_core::{
8−<<<<<<< HEAD
98 chars::{char_is_linebreak, char_is_whitespace},
10− history::History,
11−=======
12− auto_detect_line_ending, default_line_ending,
13−>>>>>>> 491a8b3 (resolved conflict in rebase)
9+ auto_detect_line_ending, DEFAULT_LINE_ENDING, history::History,
1410 syntax::{LanguageConfiguration, LOADER},
15− ChangeSet, Diagnostic, History, LineEnding, Rope, Selection, State, Syntax, Transaction,
11+ ChangeSet, Diagnostic, LineEnding, Rope, Selection, State, Syntax, Transaction,
1612};
1713
1814use crate::{DocumentId, ViewId};
@@ -26,8 +22,6 @@ pub enum Mode {
2622 Insert,
2723}
2824
29−<<<<<<< HEAD
30−
3125#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
3226pub enum IndentStyle {
3327 Tabs,
@@ -49,8 +43,6 @@ pub enum LineEnding {
4943 PS = 8, // U+2029 -- ParagraphSeparator
5044}
5145
52−=======
53−>>>>>>> 491a8b3 (resolved conflict in rebase)
5446pub struct Document {
5547 // rope + selection
5648 pub(crate) id: DocumentId,
@@ -84,7 +76,7 @@ pub struct Document {
8476
8577 diagnostics: Vec<Diagnostic>,
8678 language_server: Option<Arc<helix_lsp::Client>>,
87− line_ending: Option<LineEnding>,
79+ line_ending: LineEnding,
8880}
8981
9082use std::fmt;
@@ -177,7 +169,6 @@ impl Document {
177169 pub fn new(text: Rope) -> Self {
178170 let changes = ChangeSet::new(&text);
179171 let old_state = None;
180− let line_ending = default_line_ending();
181172
182173 Self {
183174 id: DocumentId::default(),
@@ -196,7 +187,7 @@ impl Document {
196187 history: Cell::new(History::default()),
197188 last_saved_revision: 0,
198189 language_server: None,
199− line_ending,
190+ line_ending: DEFAULT_LINE_ENDING,
200191 }
201192 }
202193
@@ -217,16 +208,13 @@ impl Document {
217208 };
218209
219210 // search for line endings
220− let line_ending = auto_detect_line_ending(&doc);
211+ let line_ending = auto_detect_line_ending(&doc).unwrap_or(DEFAULT_LINE_ENDING);
221212
222213 let mut doc = Self::new(doc);
223214 // set the path and try detecting the language
224215 doc.set_path(&path)?;
225−<<<<<<< HEAD
226216 doc.detect_indent_style();
227−=======
228217 doc.set_line_ending(line_ending);
229−>>>>>>> 491a8b3 (resolved conflict in rebase)
230218
231219 Ok(doc)
232220 }
@@ -485,7 +473,7 @@ impl Document {
485473 self.selections.insert(view_id, selection);
486474 }
487475
488− pub fn set_line_ending(&mut self, line_ending: Option<LineEnding>) {
476+ pub fn set_line_ending(&mut self, line_ending: LineEnding) {
489477 self.line_ending = line_ending;
490478 }
491479