From 2c7a42fadce3c5db4e8521ef9d9a262331d7409f Mon Sep 17 00:00:00 2001 From: josephgladwingeorge Date: Fri, 28 Mar 2025 19:24:25 +0530 Subject: [PATCH] modified compare function --- lib/utility.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/utility.dart b/lib/utility.dart index bd775bc..0052816 100644 --- a/lib/utility.dart +++ b/lib/utility.dart @@ -66,13 +66,13 @@ class Utility { newIndex++; if (oldIndex < oldWords.length && newIndex < newWords.length) { - var nextOldWord = oldWords[oldIndex]; var newSubIndex = newIndex; var oldSubIndex = oldIndex; while (newSubIndex < newWords.length && - newWords[newSubIndex].text != nextOldWord.text) { + newWords[newSubIndex].text != oldWords[oldSubIndex].text) { + //nextOldWord was not incremented in the loop hence used indexing for nextOldWord WordDelta wordDelta = - WordDelta(old: nextOldWord, modified: newWords[newSubIndex]); + WordDelta(old: oldWords[oldSubIndex], modified: newWords[newSubIndex]); delta.wordDeltas.add(wordDelta); newSubIndex++; oldSubIndex++;