From 59a0f71754a568f01cbd56daed10c26cd7364d58 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 12 Jul 2023 00:23:41 +0200 Subject: [PATCH] fix: better names for delta operation args --- src/factory.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/factory.rs b/src/factory.rs index bd3fce6..b9c47c2 100644 --- a/src/factory.rs +++ b/src/factory.rs @@ -8,18 +8,18 @@ pub trait OperationFactory { self.delta(0, txt, self.content().len()) } - fn delta(&self, skip: usize, txt: &str, tail: usize) -> Option { + fn delta(&self, start: usize, txt: &str, end: usize) -> Option { let mut out = OperationSeq::default(); let content = self.content(); - let tail_index = content.len() - tail; - let content_slice = &content[skip..tail]; + let tail_skip = content.len() - end; + let content_slice = &content[start..tail_skip]; if content_slice == txt { // if slice equals given text, no operation should be taken return None; } - out.retain(skip as u64); + out.retain(start as u64); let diff = TextDiff::from_chars(content_slice, txt); @@ -31,7 +31,7 @@ pub trait OperationFactory { } } - out.retain(tail_index as u64); + out.retain(tail_skip as u64); Some(out) }