mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-26 03:13:29 +04:00
parent
ea6667070f
commit
82fdfdc38e
@ -147,7 +147,12 @@ pub fn load(path: PathBuf) -> Result<Self, Error> {
|
||||
Rope::from("\n")
|
||||
} else {
|
||||
let file = File::open(&path).context(format!("unable to open {:?}", path))?;
|
||||
Rope::from_reader(BufReader::new(file))?
|
||||
let mut doc = Rope::from_reader(BufReader::new(file))?;
|
||||
// add missing newline at the end of file
|
||||
if doc.byte(doc.len_bytes() - 1) != b'\n' {
|
||||
doc.insert_char(doc.len_chars(), '\n');
|
||||
}
|
||||
doc
|
||||
};
|
||||
|
||||
let mut doc = Self::new(doc);
|
||||
|
Loading…
Reference in New Issue
Block a user