summaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/document.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index b6b2f664..631c540b 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -24,7 +24,7 @@ use helix_core::{
DEFAULT_LINE_ENDING,
};
-use crate::{DocumentId, Editor, ViewId};
+use crate::{DocumentId, Editor, View, ViewId};
/// 8kB of buffer space for encoding and decoding `Rope`s.
const BUF_SIZE: usize = 8192;
@@ -601,7 +601,7 @@ impl Document {
}
/// Reload the document from its path.
- pub fn reload(&mut self, view_id: ViewId) -> Result<(), Error> {
+ pub fn reload(&mut self, view: &mut View) -> Result<(), Error> {
let encoding = &self.encoding;
let path = self.path().filter(|path| path.exists());
@@ -617,8 +617,9 @@ impl Document {
// This is not considered a modification of the contents of the file regardless
// of the encoding.
let transaction = helix_core::diff::compare_ropes(self.text(), &rope);
- self.apply(&transaction, view_id);
- self.append_changes_to_history(view_id);
+ self.apply(&transaction, view.id);
+ view.apply(&transaction, self);
+ self.append_changes_to_history(view.id);
self.reset_modified();
self.detect_indent_and_line_ending();
@@ -862,9 +863,10 @@ impl Document {
self.savepoint = Some(Transaction::new(self.text()));
}
- pub fn restore(&mut self, view_id: ViewId) {
+ pub fn restore(&mut self, view: &mut View) {
if let Some(revert) = self.savepoint.take() {
- self.apply(&revert, view_id);
+ self.apply(&revert, view.id);
+ view.apply(&revert, self);
}
}