Merge UndoHistory and History, storing also operations in the latter

This commit is contained in:
Antonio Scandurra
2021-04-12 16:01:41 +02:00
parent d0b06a2a1d
commit 472ff1621f
3 changed files with 94 additions and 88 deletions
+2 -2
View File
@@ -345,7 +345,7 @@ impl Worktree {
let mut file = smol::fs::File::open(&path).await?;
let mut base_text = String::new();
file.read_to_string(&mut base_text).await?;
let history = History { base_text };
let history = History::new(Arc::from(base_text));
tree.0.write().histories.insert(entry_id, history.clone());
Ok(history)
}
@@ -717,7 +717,7 @@ mod test {
.await
.unwrap();
assert_eq!(history.base_text, buffer.text());
assert_eq!(history.base_text.as_ref(), buffer.text());
})
}
}