mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 12:45:00 +00:00
Added improved editing support for command-r-plus
This commit is contained in:
parent
b882d5db4c
commit
cd838901d1
4 changed files with 34 additions and 5 deletions
|
@ -312,7 +312,10 @@ separators = "|".join([HEAD, DIVIDER, UPDATED])
|
|||
split_re = re.compile(r"^((?:" + separators + r")[ ]*\n)", re.MULTILINE | re.DOTALL)
|
||||
|
||||
|
||||
missing_filename_err = f"Bad/missing filename. Filename should be alone on the line before {HEAD}"
|
||||
missing_filename_err = (
|
||||
"Bad/missing filename. The filename must be alone on the line before the opening fence"
|
||||
" {fence[0]}"
|
||||
)
|
||||
|
||||
|
||||
def strip_filename(filename, fence):
|
||||
|
@ -325,6 +328,9 @@ def strip_filename(filename, fence):
|
|||
if filename.startswith(start_fence):
|
||||
return
|
||||
|
||||
filename = filename.rstrip(":")
|
||||
filename = filename.strip("`")
|
||||
|
||||
return filename
|
||||
|
||||
|
||||
|
@ -363,12 +369,12 @@ def find_original_update_blocks(content, fence=DEFAULT_FENCE):
|
|||
if current_filename:
|
||||
filename = current_filename
|
||||
else:
|
||||
raise ValueError(missing_filename_err)
|
||||
raise ValueError(missing_filename_err.format(fence=fence))
|
||||
except IndexError:
|
||||
if current_filename:
|
||||
filename = current_filename
|
||||
else:
|
||||
raise ValueError(missing_filename_err)
|
||||
raise ValueError(missing_filename_err.format(fence=fence))
|
||||
|
||||
current_filename = filename
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue