Update tab's modified icon via a saved event emitted from buffer

This commit is contained in:
Max Brunsfeld
2021-04-06 15:47:05 -07:00
parent dabd6abe37
commit bd37b11306
5 changed files with 37 additions and 15 deletions
+5
View File
@@ -244,6 +244,10 @@ impl Buffer {
pub fn save(&self, ctx: &mut ModelContext<Self>) -> Option<Task<Result<()>>> {
if let Some(file) = &self.file {
let snapshot = self.snapshot();
// TODO - don't emit this until the save has finished
ctx.emit(Event::Saved);
Some(file.save(snapshot, ctx.app()))
} else {
None
@@ -1395,6 +1399,7 @@ impl Snapshot {
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Event {
Edited(Vec<Edit>),
Saved,
}
impl Entity for Buffer {