mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
Complete the search for viable hunks all the way down to 0 space context lines #435
This commit is contained in:
parent
e0e454fe82
commit
29a578c621
1 changed files with 5 additions and 1 deletions
|
@ -262,6 +262,9 @@ def normalize_hunk(hunk):
|
|||
def directly_apply_hunk(content, hunk):
|
||||
before, after = hunk_to_before_after(hunk)
|
||||
|
||||
if not before:
|
||||
return
|
||||
|
||||
before_lines, _ = hunk_to_before_after(hunk, lines=True)
|
||||
before_lines = "".join([line.strip() for line in before_lines])
|
||||
|
||||
|
@ -283,7 +286,8 @@ def apply_partial_hunk(content, preceding_context, changes, following_context):
|
|||
|
||||
use_all = len_prec + len_foll
|
||||
|
||||
for drop in range(use_all):
|
||||
# if there is a - in the hunk, we can go all the way to `use=0`
|
||||
for drop in range(use_all + 1):
|
||||
use = use_all - drop
|
||||
|
||||
for use_prec in range(len_prec, -1, -1):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue