Skip to content

Commit

Permalink
finally got reload working
Browse files Browse the repository at this point in the history
  • Loading branch information
kirawi committed Feb 19, 2023
1 parent 92064f7 commit 18459f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,12 @@ impl Document {
.into_std()
.await;
tokio::task::spawn_blocking(move || -> anyhow::Result<()> {
let append = undofile.metadata()?.len() != 0;
let append =
History::deserialize(&mut std::fs::File::open(&undofile_path)?, &path)
.is_ok();
if !append {
undofile.set_len(0)?;
}
history.serialize(&mut undofile, &path, current_rev, append)?;
Ok(())
})
Expand Down

0 comments on commit 18459f8

Please sign in to comment.