mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Bugfix to strip line numbers with leading space
This commit is contained in:
@@ -193,12 +193,12 @@ Result:
|
||||
// Strip line numbers from search and replace content if every line starts with a line number
|
||||
const hasLineNumbers = (content: string) => {
|
||||
const lines = content.split(/\r?\n/);
|
||||
return lines.length > 0 && lines.every(line => /^\d+\s+\|(?!\|)/.test(line));
|
||||
return lines.length > 0 && lines.every(line => /^\s*\d+\s+\|(?!\|)/.test(line));
|
||||
};
|
||||
|
||||
if (hasLineNumbers(searchContent) && hasLineNumbers(replaceContent)) {
|
||||
const stripLineNumbers = (content: string) => {
|
||||
return content.replace(/^\d+\s+\|(?!\|)/gm, '');
|
||||
return content.replace(/^\s*\d+\s+\|(?!\|)/gm, '');
|
||||
};
|
||||
|
||||
searchContent = stripLineNumbers(searchContent);
|
||||
|
||||
Reference in New Issue
Block a user