--- a/eric6/UI/DiffDialog.py Sun Apr 11 11:34:32 2021 +0200 +++ b/eric6/UI/DiffDialog.py Sun Apr 11 12:38:16 2021 +0200 @@ -229,15 +229,14 @@ @param fromfiledate modification time of the first file (string) @param tofiledate modification time of the second file (string) """ - paras = 0 - for line in unified_diff(a, b, fromfile, tofile, - fromfiledate, tofiledate): + for paras, line in enumerate( + unified_diff(a, b, fromfile, tofile, fromfiledate, tofiledate) + ): self.__appendText(line) - paras += 1 if not (paras % self.updateInterval): QApplication.processEvents() - if paras == 0: + if self.contents.toPlainText().strip() == "": self.__appendText(self.tr('There is no difference.')) def __generateContextDiff(self, a, b, fromfile, tofile, @@ -252,15 +251,14 @@ @param fromfiledate modification time of the first file (string) @param tofiledate modification time of the second file (string) """ - paras = 0 - for line in context_diff(a, b, fromfile, tofile, - fromfiledate, tofiledate): + for paras, line in enumerate( + context_diff(a, b, fromfile, tofile, fromfiledate, tofiledate) + ): self.__appendText(line) - paras += 1 if not (paras % self.updateInterval): QApplication.processEvents() - if paras == 0: + if self.contents.toPlainText().strip() == "": self.__appendText(self.tr('There is no difference.')) def __fileChanged(self):