mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
bugfix live diffs in wholefile coder
This commit is contained in:
parent
c20b1bb073
commit
aacbcd32d4
1 changed files with 4 additions and 4 deletions
|
@ -56,7 +56,7 @@ class WholeFileCoder(Coder):
|
||||||
full_path = (Path(self.root) / fname).absolute()
|
full_path = (Path(self.root) / fname).absolute()
|
||||||
|
|
||||||
if mode == "diff":
|
if mode == "diff":
|
||||||
output += self.do_live_diff(full_path, new_lines)
|
output += self.do_live_diff(full_path, new_lines, True)
|
||||||
elif self.allowed_to_edit(fname):
|
elif self.allowed_to_edit(fname):
|
||||||
edited.add(fname)
|
edited.add(fname)
|
||||||
new_lines = "".join(new_lines)
|
new_lines = "".join(new_lines)
|
||||||
|
@ -101,7 +101,7 @@ class WholeFileCoder(Coder):
|
||||||
if fname is not None:
|
if fname is not None:
|
||||||
# ending an existing block
|
# ending an existing block
|
||||||
full_path = (Path(self.root) / fname).absolute()
|
full_path = (Path(self.root) / fname).absolute()
|
||||||
output += self.do_live_diff(full_path, new_lines)
|
output += self.do_live_diff(full_path, new_lines, False)
|
||||||
return "\n".join(output)
|
return "\n".join(output)
|
||||||
|
|
||||||
if fname:
|
if fname:
|
||||||
|
@ -113,14 +113,14 @@ class WholeFileCoder(Coder):
|
||||||
|
|
||||||
return edited
|
return edited
|
||||||
|
|
||||||
def do_live_diff(self, full_path, new_lines):
|
def do_live_diff(self, full_path, new_lines, final):
|
||||||
if full_path.exists():
|
if full_path.exists():
|
||||||
orig_lines = self.io.read_text(full_path).splitlines(keepends=True)
|
orig_lines = self.io.read_text(full_path).splitlines(keepends=True)
|
||||||
|
|
||||||
show_diff = diffs.diff_partial_update(
|
show_diff = diffs.diff_partial_update(
|
||||||
orig_lines,
|
orig_lines,
|
||||||
new_lines,
|
new_lines,
|
||||||
final=True,
|
final=final,
|
||||||
).splitlines()
|
).splitlines()
|
||||||
output = show_diff
|
output = show_diff
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue