mycode-cli 0.2.1__py3-none-any.whl → 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mycode/cli/render.py CHANGED
@@ -563,20 +563,26 @@ class ReplyRenderer:
563
563
  lower = name.lower()
564
564
 
565
565
  if lower == "edit":
566
- old_text = args.get("oldText")
567
- new_text = args.get("newText")
568
- if isinstance(old_text, str) and isinstance(new_text, str):
566
+ edits = args.get("edits")
567
+ if isinstance(edits, list):
569
568
  added = 0
570
569
  removed = 0
571
- for tag, old_start, old_end, new_start, new_end in SequenceMatcher(
572
- None,
573
- old_text.splitlines(),
574
- new_text.splitlines(),
575
- ).get_opcodes():
576
- if tag in {"replace", "delete"}:
577
- removed += old_end - old_start
578
- if tag in {"replace", "insert"}:
579
- added += new_end - new_start
570
+ for entry in edits:
571
+ if not isinstance(entry, dict):
572
+ continue
573
+ old_text = entry.get("oldText")
574
+ new_text = entry.get("newText")
575
+ if not isinstance(old_text, str) or not isinstance(new_text, str):
576
+ continue
577
+ for tag, old_start, old_end, new_start, new_end in SequenceMatcher(
578
+ None,
579
+ old_text.splitlines(),
580
+ new_text.splitlines(),
581
+ ).get_opcodes():
582
+ if tag in {"replace", "delete"}:
583
+ removed += old_end - old_start
584
+ if tag in {"replace", "insert"}:
585
+ added += new_end - new_start
580
586
  parts.append(f"+{added}", style="green")
581
587
  parts.append(f" −{removed}", style="red")
582
588
  elif lower == "read":