aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/document.rs9
-rw-r--r--helix-view/src/editor.rs2
-rw-r--r--helix-view/src/lib.rs11
-rw-r--r--helix-view/src/view.rs2
4 files changed, 4 insertions, 20 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index 856e5628..6b33ea6a 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -27,7 +27,7 @@ use helix_core::{
};
use crate::editor::RedrawHandle;
-use crate::{apply_transaction, DocumentId, Editor, View, ViewId};
+use crate::{DocumentId, Editor, View, ViewId};
/// 8kB of buffer space for encoding and decoding `Rope`s.
const BUF_SIZE: usize = 8192;
@@ -650,7 +650,7 @@ 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);
- apply_transaction(&transaction, self, view);
+ self.apply(&transaction, view.id);
self.append_changes_to_history(view);
self.reset_modified();
@@ -852,9 +852,6 @@ impl Document {
}
/// Apply a [`Transaction`] to the [`Document`] to change its text.
- /// Instead of calling this function directly, use [crate::apply_transaction]
- /// to ensure that the transaction is applied to the appropriate [`View`] as
- /// well.
pub fn apply(&mut self, transaction: &Transaction, view_id: ViewId) -> bool {
// store the state just before any changes are made. This allows us to undo to the
// state just before a transaction was applied.
@@ -911,7 +908,7 @@ impl Document {
pub fn restore(&mut self, view: &mut View) {
if let Some(revert) = self.savepoint.take() {
- apply_transaction(&revert, self, view);
+ self.apply(&revert, view.id);
}
}
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 4a44a00c..3ee0325d 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -1502,6 +1502,6 @@ fn try_restore_indent(doc: &mut Document, view: &mut View) {
let line_start_pos = text.line_to_char(range.cursor_line(text));
(line_start_pos, pos, None)
});
- crate::apply_transaction(&transaction, doc, view);
+ doc.apply(&transaction, view.id);
}
}
diff --git a/helix-view/src/lib.rs b/helix-view/src/lib.rs
index 9cf36ae0..9a980446 100644
--- a/helix-view/src/lib.rs
+++ b/helix-view/src/lib.rs
@@ -66,17 +66,6 @@ pub fn align_view(doc: &Document, view: &mut View, align: Align) {
view.offset.row = line.saturating_sub(relative);
}
-/// Applies a [`helix_core::Transaction`] to the given [`Document`]
-/// and [`View`].
-pub fn apply_transaction(
- transaction: &helix_core::Transaction,
- doc: &mut Document,
- view: &View,
-) -> bool {
- // TODO remove this helper function. Just call Document::apply everywhere directly.
- doc.apply(transaction, view.id)
-}
-
pub use document::Document;
pub use editor::Editor;
pub use theme::Theme;
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index c09d502d..23fb85c9 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -380,8 +380,6 @@ impl View {
// }
/// Applies a [`Transaction`] to the view.
- /// Instead of calling this function directly, use [crate::apply_transaction]
- /// which applies a transaction to the [`Document`] and view together.
pub fn apply(&mut self, transaction: &Transaction, doc: &mut Document) {
self.jumps.apply(transaction, doc);
self.doc_revisions