Skip to content

Commit

Permalink
Only insert in lists instead of replacing
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanChristopheMorinPerso committed Sep 1, 2023
1 parent 36b5424 commit 4cdf74e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions percy/render/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,14 +774,17 @@ def _patch(self, operation):
match_lines[i] = m
match_lines = dict(sorted(match_lines.items(), reverse=True))

# remove elements and find insert position
new_range = deepcopy(range)
insert_index = 0
index_set = False
for i, m in match_lines.items():
new_range.pop(i)
insert_index = i
index_set = True
# remove elements
if op == "remove":
for i, m in match_lines.items():
new_range.pop(i)
insert_index = i
index_set = True

# Find insert position
range = new_range
if not index_set:
for i, e in reversed(list(enumerate(range))):
Expand Down

0 comments on commit 4cdf74e

Please sign in to comment.