mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 04:11:10 -05:00
Handle Windows line endings (#62)
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# Roo Cline Changelog
|
# Roo Cline Changelog
|
||||||
|
|
||||||
|
## [2.1.18]
|
||||||
|
|
||||||
|
- Diff editing bugfix to handle Windows line endings
|
||||||
|
|
||||||
## [2.1.17]
|
## [2.1.17]
|
||||||
|
|
||||||
- Switch to search/replace diffs in experimental diff editing mode
|
- Switch to search/replace diffs in experimental diff editing mode
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ A fork of Cline, an autonomous coding agent, with some added experimental config
|
|||||||
- Unit test coverage (written almost entirely by Roo Cline!)
|
- Unit test coverage (written almost entirely by Roo Cline!)
|
||||||
- Support for playing sound effects
|
- Support for playing sound effects
|
||||||
- Support for OpenRouter compression
|
- Support for OpenRouter compression
|
||||||
- Support for editing through diffs (very experimental)
|
|
||||||
- Support for gemini-exp-1206
|
- Support for gemini-exp-1206
|
||||||
- Support for copying prompts from the history screen
|
- Support for copying prompts from the history screen
|
||||||
|
- Support for editing through diffs / handling truncated full-file edits
|
||||||
|
|
||||||
Here's an example of Roo-Cline autonomously creating a snake game with "Always approve write operations" and "Always approve browser actions" turned on:
|
Here's an example of Roo-Cline autonomously creating a snake game with "Always approve write operations" and "Always approve browser actions" turned on:
|
||||||
|
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "roo-cline",
|
"name": "roo-cline",
|
||||||
"version": "2.1.17",
|
"version": "2.1.18",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "roo-cline",
|
"name": "roo-cline",
|
||||||
"version": "2.1.17",
|
"version": "2.1.18",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anthropic-ai/bedrock-sdk": "^0.10.2",
|
"@anthropic-ai/bedrock-sdk": "^0.10.2",
|
||||||
"@anthropic-ai/sdk": "^0.26.0",
|
"@anthropic-ai/sdk": "^0.26.0",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"displayName": "Roo Cline",
|
"displayName": "Roo Cline",
|
||||||
"description": "A fork of Cline, an autonomous coding agent, with some added experimental configuration and automation features.",
|
"description": "A fork of Cline, an autonomous coding agent, with some added experimental configuration and automation features.",
|
||||||
"publisher": "RooVeterinaryInc",
|
"publisher": "RooVeterinaryInc",
|
||||||
"version": "2.1.17",
|
"version": "2.1.18",
|
||||||
"icon": "assets/icons/rocket.png",
|
"icon": "assets/icons/rocket.png",
|
||||||
"galleryBanner": {
|
"galleryBanner": {
|
||||||
"color": "#617A91",
|
"color": "#617A91",
|
||||||
|
|||||||
@@ -181,6 +181,23 @@ function test() {
|
|||||||
expect(result).toBe("\tfunction test() {\n\t\t// First comment\n\t\t// Second comment\n\t\treturn true;\n\t}")
|
expect(result).toBe("\tfunction test() {\n\t\t// First comment\n\t\t// Second comment\n\t\treturn true;\n\t}")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should handle Windows-style CRLF line endings', () => {
|
||||||
|
const originalContent = "function test() {\r\n return true;\r\n}\r\n"
|
||||||
|
const diffContent = `test.ts
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
function test() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
=======
|
||||||
|
function test() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
>>>>>>> REPLACE`
|
||||||
|
|
||||||
|
const result = strategy.applyDiff(originalContent, diffContent)
|
||||||
|
expect(result).toBe("function test() {\r\n return false;\r\n}\r\n")
|
||||||
|
})
|
||||||
|
|
||||||
it('should return false if search content does not match', () => {
|
it('should return false if search content does not match', () => {
|
||||||
const originalContent = `function hello() {
|
const originalContent = `function hello() {
|
||||||
console.log("hello")
|
console.log("hello")
|
||||||
|
|||||||
@@ -70,10 +70,13 @@ Your search/replace content here
|
|||||||
|
|
||||||
const [_, searchContent, replaceContent] = match;
|
const [_, searchContent, replaceContent] = match;
|
||||||
|
|
||||||
// Split content into lines
|
// Detect line ending from original content
|
||||||
const searchLines = searchContent.trim().split('\n');
|
const lineEnding = originalContent.includes('\r\n') ? '\r\n' : '\n';
|
||||||
const replaceLines = replaceContent.trim().split('\n');
|
|
||||||
const originalLines = originalContent.split('\n');
|
// Split content into lines, handling both \n and \r\n
|
||||||
|
const searchLines = searchContent.trim().split(/\r?\n/);
|
||||||
|
const replaceLines = replaceContent.trim().split(/\r?\n/);
|
||||||
|
const originalLines = originalContent.split(/\r?\n/);
|
||||||
|
|
||||||
// Find the search content in the original
|
// Find the search content in the original
|
||||||
let matchIndex = -1;
|
let matchIndex = -1;
|
||||||
@@ -166,6 +169,6 @@ Your search/replace content here
|
|||||||
const beforeMatch = originalLines.slice(0, matchIndex);
|
const beforeMatch = originalLines.slice(0, matchIndex);
|
||||||
const afterMatch = originalLines.slice(matchIndex + searchLines.length);
|
const afterMatch = originalLines.slice(matchIndex + searchLines.length);
|
||||||
|
|
||||||
return [...beforeMatch, ...indentedReplace, ...afterMatch].join('\n');
|
return [...beforeMatch, ...indentedReplace, ...afterMatch].join(lineEnding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -296,7 +296,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
|
|||||||
|
|
||||||
<div style={{ marginBottom: 5 }}>
|
<div style={{ marginBottom: 5 }}>
|
||||||
<VSCodeCheckbox checked={diffEnabled} onChange={(e: any) => setDiffEnabled(e.target.checked)}>
|
<VSCodeCheckbox checked={diffEnabled} onChange={(e: any) => setDiffEnabled(e.target.checked)}>
|
||||||
<span style={{ fontWeight: "500" }}>Enable editing through diffs (very experimental!)</span>
|
<span style={{ fontWeight: "500" }}>Enable editing through diffs</span>
|
||||||
</VSCodeCheckbox>
|
</VSCodeCheckbox>
|
||||||
<p
|
<p
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
Reference in New Issue
Block a user