fix: map rows edited in place one to one

A replace opcode of equal size is a line-by-line edit. Collapsing it onto its first line sent every ref citing a table row to the first row.
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 09:48:33 +02:00
1 parent 0242dc77ee
commit fd9a9b14f8
2 files changed
+18 -1

No files matched your search

+9
View File
@@ -378,6 +378,15 @@ class TestAnchorBlock(unittest.TestCase):
self.assertEqual(result.status, "CHANGED")
self.assertEqual(result.start, 3)
def test_rows_edited_in_place_keep_their_own_line(self):
rows = [f'{{"ipl{i}", 0x{i:02x}}}' for i in range(8)]
pin = ["a", "b", *rows, "z"]
head = ["a", "b", *[row + ", false" for row in rows], "z"]
for line in (3, 5, 10):
result = anchor_block(pin, head, line, line)
self.assertEqual(result.status, "CHANGED")
self.assertEqual(result.start, line)
def test_gone_when_content_vanished(self):
result = anchor_block(["a", "unique marker", "b"], ["x"] * 200, 2, 2)
self.assertEqual(result.status, "GONE")