Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-vcs/src/diff.rs')
| -rw-r--r-- | helix-vcs/src/diff.rs | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/helix-vcs/src/diff.rs b/helix-vcs/src/diff.rs index d87f3ce7..6ec29813 100644 --- a/helix-vcs/src/diff.rs +++ b/helix-vcs/src/diff.rs @@ -35,7 +35,6 @@ struct DiffInner { hunks: Vec<Hunk>, } -/// Representation of a diff that can be updated. #[derive(Clone, Debug)] pub struct DiffHandle { channel: UnboundedSender<Event>, @@ -66,13 +65,11 @@ impl DiffHandle { (differ, handle) } - /// Switch base and modified texts' roles pub fn invert(&mut self) { self.inverted = !self.inverted; } - /// Load the actual diff - pub fn load(&self) -> Diff<'_> { + pub fn load(&self) -> Diff { Diff { diff: self.diff.read(), inverted: self.inverted, @@ -92,7 +89,6 @@ impl DiffHandle { self.update_document_impl(doc, self.inverted, Some(RenderLock { lock, timeout })) } - /// Updates the base text of the diff. Returns if the update was successful. pub fn update_diff_base(&self, diff_base: Rope) -> bool { self.update_document_impl(diff_base, !self.inverted, None) } @@ -132,7 +128,6 @@ pub struct Diff<'a> { } impl Diff<'_> { - /// Returns the base [Rope] of the [Diff] pub fn diff_base(&self) -> &Rope { if self.inverted { &self.diff.doc @@ -141,7 +136,6 @@ impl Diff<'_> { } } - /// Returns the [Rope] being compared against pub fn doc(&self) -> &Rope { if self.inverted { &self.diff.diff_base @@ -172,7 +166,6 @@ impl Diff<'_> { self.len() == 0 } - /// Gives the index of the first hunk after the given line, if one exists. pub fn next_hunk(&self, line: u32) -> Option<u32> { let hunk_range = if self.inverted { |hunk: &Hunk| hunk.before.clone() @@ -199,7 +192,6 @@ impl Diff<'_> { } } - /// Gives the index of the first hunk before the given line, if one exists. pub fn prev_hunk(&self, line: u32) -> Option<u32> { let hunk_range = if self.inverted { |hunk: &Hunk| hunk.before.clone() @@ -243,7 +235,6 @@ impl Diff<'_> { } } - /// Returns the index of the hunk containing the given line if it exists. pub fn hunk_at(&self, line: u32, include_removal: bool) -> Option<u32> { let hunk_range = if self.inverted { |hunk: &Hunk| hunk.before.clone() |