fix: temp value was dropped

This commit is contained in:
əlemi 2023-04-18 21:46:19 +02:00
parent ead5ffc49c
commit b8aa7d5fce

View file

@ -6,11 +6,12 @@ pub trait OperationFactory {
fn replace(&self, txt: &str) -> OperationSeq {
let mut out = OperationSeq::default();
if self.content() == txt {
let content = self.content();
if content == txt {
return out; // TODO this won't work, should we return a noop instead?
}
let diff = TextDiff::from_chars(self.content().as_str(), txt);
let diff = TextDiff::from_chars(content.as_str(), txt);
for change in diff.iter_all_changes() {
match change.tag() {