Handle case where part="" and replace is non-empty

This commit is contained in:
Paul Gauthier 2023-05-14 11:07:22 -07:00
parent e9debe71e8
commit 0c05e3d957

View file

@ -44,6 +44,12 @@ def try_dotdotdots(whole, part, replace):
if not part and not replace: if not part and not replace:
continue continue
if not part and replace:
if not whole.endswith("\n"):
whole += "\n"
whole += replace
continue
if part not in whole: if part not in whole:
raise ValueError("No perfect matching chunk in edit block with ...") raise ValueError("No perfect matching chunk in edit block with ...")