I noticed when Claude uses the Search and Replace tool call, the formatting is mangled; but when I tell it to use the edit_file tool, it works perfectly fine. So, I assume the issue is with this new tool call?
Claude Sonnet 4 mangles formatting in Cursor. I’ve seen it too. Haven’t used Opus as much so can’t confirm. I should also add that applying the code manually works perfectly. It’s only the agent’s tool calls that seem to get “mangled”.
Thank you! I forgot to mention that, but yes if you select the “Apply” button it will properly apply the code. That is one workaround to it right now. And I did notice it seems to be only Claude, not just Claude 4 sonnet but 3.7 too. Haven’t thoroughly tested with other models.
I made this correlation because the search and replace tool was introduced not too long ago and after this tool was introduced, Claude started destroying the formatting, and when I ask it to use the edit_file tool it works perfectly fine.