-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Which version of the app are you using?
v3.17.1
Which API Provider are you using?
Claude
Which Model are you using?
sonnet-3.5
What happened?
When performing sequential insert_content operations on a file - first inserting at the beginning (line 1) and then appending at the end (line 0) - an extra blank line is added between the two inserted contents.
Steps to reproduce
- Create a new file (or use an existing empty file) because insert_content cannot create files (Bug: insert_content fails to create missing filesย #3652)
- Perform the following sequential insert_content operations:
First operation (inserting at the beginning):
<insert_content>
<path>test_insert.txt</path>
<line>1</line>
<content>Line 1: This is the first line inserted at the beginning.
Line 2: This is the second line inserted at the beginning.</content>
</insert_content>Second operation (appending at the end):
<insert_content>
<path>test_insert.txt</path>
<line>0</line>
<content>Line 3: This content is appended at the end of the file.
Line 4: This is the last line appended at the end.</content>
</insert_content>Expected result
The file should contain the content from both operations without any extra blank lines:
Line 1: This is the first line inserted at the beginning.
Line 2: This is the second line inserted at the beginning.
Line 3: This content is appended at the end of the file.
Line 4: This is the last line appended at the end.
Actual behavior
The file contains an extra blank line between the two inserted contents:
Line 1: This is the first line inserted at the beginning.
Line 2: This is the second line inserted at the beginning.
Line 3: This content is appended at the end of the file.
Line 4: This is the last line appended at the end.
Additional context
This extra blank line can cause issues when generating code or other content where precise formatting is important. The insert_content tool should maintain consistent behavior without adding unexpected blank lines.
A fix for this issue should include tests to ensure proper handling of carriage returns during insert operations, specifically:
- Multiple leading carriage returns
- Multiple trailing carriage returns
These tests would ensure that blank lines are preserved exactly as specified in the content without adding or removing any.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status