mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
Fixes
This commit is contained in:
parent
c3d12c5663
commit
219550c515
1 changed files with 4 additions and 1 deletions
|
|
@ -103,7 +103,7 @@ function lineTrimmedFallbackMatch(
|
|||
// Add one char for newline if not the first line
|
||||
|
||||
const matchedBlock = originalLines.slice(i, i + searchLines.length).join("\n")
|
||||
const matchEnd = matchStart + matchedBlock.length
|
||||
const matchEnd = matchStart + matchedBlock.length + 1
|
||||
|
||||
return [matchStart, matchEnd]
|
||||
}
|
||||
|
|
@ -171,7 +171,9 @@ export async function constructNewFileContent(
|
|||
if (exactIndex !== -1) {
|
||||
searchMatchIndex = exactIndex
|
||||
searchEndIndex = exactIndex + currentSearchContent.length
|
||||
console.log("Exact match found", searchMatchIndex, searchEndIndex)
|
||||
} else {
|
||||
console.log("No exact match found, trying fallback line-trimmed matching")
|
||||
// Attempt fallback line-trimmed matching
|
||||
const fallbackMatch = lineTrimmedFallbackMatch(
|
||||
originalContent,
|
||||
|
|
@ -180,6 +182,7 @@ export async function constructNewFileContent(
|
|||
)
|
||||
if (fallbackMatch) {
|
||||
;[searchMatchIndex, searchEndIndex] = fallbackMatch
|
||||
console.log("Fallback line-trimmed match found", searchMatchIndex, searchEndIndex)
|
||||
} else {
|
||||
throw new Error(
|
||||
`The SEARCH block:\n${currentSearchContent.trimEnd()}\n...does not match anything in the file.`,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue