Skip to content

Conversation

@Kalmaegi
Copy link
Contributor

@Kalmaegi Kalmaegi commented Nov 11, 2025

Update Vim.change_surround in order to ensure that there's no
overlapping edits by keeping track of where the open string range ends
and ensuring that the closing string range start does not go lower than
the open string range end.

Closes #42316

Release Notes:

  • Fix vim's change surrounds cs inserting spaces with quotes by preventing overlapping edits

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 11, 2025
@Kalmaegi Kalmaegi changed the title fix #42316 Fix: Vim change surround adds unwanted spaces with quotes Nov 11, 2025
@Kalmaegi Kalmaegi changed the title Fix: Vim change surround adds unwanted spaces with quotes vim: Fix change surround adds unwanted spaces with quotes Nov 11, 2025
@Kalmaegi Kalmaegi marked this pull request as draft November 11, 2025 12:18
@maxdeviant maxdeviant changed the title vim: Fix change surround adds unwanted spaces with quotes vim: Fix change surround adding unwanted spaces with quotes Nov 11, 2025
@Kalmaegi
Copy link
Contributor Author

Sorry, my computer is a bit slow. I’ll run the tests locally and submit once they pass.

@Kalmaegi Kalmaegi marked this pull request as ready for review November 11, 2025 13:29
@dinocosta
Copy link
Contributor

Thank you for fixing this @Kalmaegi ! I've pushed a commit to refactor it a bit, as we can simply keep track of where the opening range ends and ensuring that we stop before we go under that value when building the closing edit range 🙂

Kalmaegi and others added 4 commits November 12, 2025 11:53
Update `Vim.change_surround` in order to ensure that there's no
overlapping edits by keeping track of where the open string range ends
and ensuring that the closing string range start does not go lower than
the open string range end.
@dinocosta dinocosta merged commit e833d1a into zed-industries:main Nov 12, 2025
37 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vim change surround adds extra spaces when using ' and "

2 participants