Skip to content

fix(editblock): allow find_filename to look past indented fenced block markers - #5663

Open
lx3133584 wants to merge 1 commit into
Aider-AI:mainfrom
lx3133584:fix/editblock-find-filename-indented-fences
Open

fix(editblock): allow find_filename to look past indented fenced block markers#5663
lx3133584 wants to merge 1 commit into
Aider-AI:mainfrom
lx3133584:fix/editblock-find-filename-indented-fences

Conversation

@lx3133584

Copy link
Copy Markdown

Problem

When fenced code block markers contain leading whitespace (e.g. " ```python"), find_filename in editblock_coder.py breaks early on the continuation check and returns None, failing to recover valid filenames in SEARCH/REPLACE blocks.

Root Cause

In aider/coders/editblock_coder.py, find_filename checked if not line.startswith(fence[0]) and not line.startswith(triple_backticks): using the unstripped line. When preceding fence lines have leading spaces, the condition evaluated to true and broke the lookback loop before inspecting the filename line.

Fix

Strip whitespace before checking whether the line starts with a fence or triple backticks (stripped = line.strip()), allowing the lookback search to proceed through indented fence lines.

Testing

Added test case in tests/basic/test_editblock.py::TestUtils::test_find_filename verifying filename recovery with indented fenced markers.

…k markers

Fixes Aider-AI#5662

Signed-off-by: Liang Xu <lx3133584@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant