diff options
author | Blaž Hrastnik | 2022-10-16 14:44:36 +0000 |
---|---|---|
committer | Skyler Hawthorne | 2022-10-19 02:31:39 +0000 |
commit | 1b6f7319cd605366de109f25821c6b84860f2a11 (patch) | |
tree | d2f8e74f4665c0922aafc3bd7e992fb51978be8d | |
parent | 55b50d9e8368793d764d36c0f363f31252900b87 (diff) |
Wire up save_queue as a part of new_document rather than open
-rw-r--r-- | helix-view/src/editor.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index ac0864e1..dc1a800e 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1062,6 +1062,13 @@ impl Editor { DocumentId(unsafe { NonZeroUsize::new_unchecked(self.next_document_id.0.get() + 1) }); doc.id = id; self.documents.insert(id, doc); + + let (save_sender, save_receiver) = tokio::sync::mpsc::unbounded_channel(); + self.saves.insert(id, save_sender); + + let stream = UnboundedReceiverStream::new(save_receiver).flatten(); + self.save_queue.push(stream); + id } @@ -1095,12 +1102,6 @@ impl Editor { self.new_document(doc) }; - let (save_sender, save_receiver) = tokio::sync::mpsc::unbounded_channel(); - self.saves.insert(id, save_sender); - - let stream = UnboundedReceiverStream::new(save_receiver).flatten(); - self.save_queue.push(stream); - self.switch(id, action); Ok(id) } |