diff options
author | Shafkath Shuhan | 2021-06-23 06:03:34 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-23 06:40:27 +0000 |
commit | fd98e743e888e8fbddf4987213afbb19dd148fd7 (patch) | |
tree | 084b7ccccb5b9ddac506c157a57fc99747ffd0f7 /helix-view/src/editor.rs | |
parent | 9706f1121de673950d8e0472062a32f18d527ad2 (diff) |
Handle non-UTF8 files
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r-- | helix-view/src/editor.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 839bcdcd..7f910b80 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -17,7 +17,7 @@ use anyhow::Error; pub use helix_core::diagnostic::Severity; pub use helix_core::register::Registers; -use helix_core::{Position, DEFAULT_LINE_ENDING}; +use helix_core::Position; #[derive(Debug)] pub struct Editor { @@ -171,8 +171,7 @@ impl Editor { } pub fn new_file(&mut self, action: Action) -> DocumentId { - use helix_core::Rope; - let doc = Document::new(Rope::from(DEFAULT_LINE_ENDING.as_str())); + let doc = Document::default(); let id = self.documents.insert(doc); self.documents[id].id = id; self.switch(id, action); @@ -190,7 +189,7 @@ impl Editor { let id = if let Some(id) = id { id } else { - let mut doc = Document::load(path, Some(&self.theme), Some(&self.syn_loader))?; + let mut doc = Document::open(path, None, Some(&self.theme), Some(&self.syn_loader))?; // try to find a language server based on the language name let language_server = doc |