Merge pull request #3828 from zjy1412/main

fix: correctly detect edit blocks in diff-fenced mode
This commit is contained in:
paul-gauthier 2025-04-19 10:03:31 -07:00 committed by GitHub
commit f1caab9de0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 67 additions and 1 deletions

View file

@ -454,7 +454,10 @@ def find_original_update_blocks(content, fence=DEFAULT_FENCE, valid_fnames=None)
"```csh",
"```tcsh",
]
next_is_editblock = i + 1 < len(lines) and head_pattern.match(lines[i + 1].strip())
# Check if the next line or the one after that is an editblock
next_is_editblock = (i + 1 < len(lines) and head_pattern.match(lines[i + 1].strip())
or i + 2 < len(lines) and head_pattern.match(lines[i + 2].strip()))
if any(line.strip().startswith(start) for start in shell_starts) and not next_is_editblock:
shell_content = []