@@ -31,7 +31,6 @@ use helix_core::{
31 line_ending::auto_detect_line_ending,
31 line_ending::auto_detect_line_ending,
32 syntax::{self, LanguageConfiguration},
32 syntax::{self, LanguageConfiguration},
33 ChangeSet, Diagnostic, LineEnding, Range, Rope, RopeBuilder, Selection, Syntax, Transaction,
33 ChangeSet, Diagnostic, LineEnding, Range, Rope, RopeBuilder, Selection, Syntax, Transaction,
37use crate::editor::{Config, RedrawHandle};
36use crate::editor::{Config, RedrawHandle};
@@ -625,7 +624,8 @@ impl Document {
627 pub fn default(config: Arc<dyn DynAccess<Config>>) -> Self {
626 pub fn default(config: Arc<dyn DynAccess<Config>>) -> Self {
627+ let line_ending: LineEnding = config.load().default_line_ending.into();
628− let text = Rope::from(NATIVE_LINE_ENDING.as_str());
628+ let text = Rope::from(line_ending.as_str());
629 Self::from(text, None, config)
629 Self::from(text, None, config)
@@ -644,8 +644,9 @@ impl Document {
644 std::fs::File::open(path).context(format!("unable to open {:?}", path))?;
644 std::fs::File::open(path).context(format!("unable to open {:?}", path))?;
645 from_reader(&mut file, encoding)?
645 from_reader(&mut file, encoding)?
647+ let line_ending: LineEnding = config.load().default_line_ending.into();
647 let encoding = encoding.unwrap_or(encoding::UTF_8);
648 let encoding = encoding.unwrap_or(encoding::UTF_8);
648− (Rope::from(NATIVE_LINE_ENDING.as_str()), encoding, false)
649+ (Rope::from(line_ending.as_str()), encoding, false)
651 let mut doc = Self::from(rope, Some((encoding, has_bom)), config);
652 let mut doc = Self::from(rope, Some((encoding, has_bom)), config);
@@ -1925,7 +1926,7 @@ mod test {
1925 Document::default(Arc::new(ArcSwap::new(Arc::new(Config::default()))))
1926 Document::default(Arc::new(ArcSwap::new(Arc::new(Config::default()))))
1927 .to_string(),
1928 .to_string(),
1928− NATIVE_LINE_ENDING.as_str()
1929+ helix_core::NATIVE_LINE_ENDING.as_str()