# Add multi selection support to UnwrapSyntaxNode \(\#35991\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/bb640c6a1c8b77031b8aabf1d5100945bf1d00ff)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: bb640c6a1c8b77031b8aabf1d5100945bf1d00ff

Requested commit: bb640c6a1c8b77031b8aabf1d5100945bf1d00ff

Commit: bb640c6a1c8b77031b8aabf1d5100945bf1d00ff

Tree: 9b8a98ef5f3915725961cec551866d058428970f

Author: Gregor

Committer: GitHub

## Message

```
Add multi selection support to UnwrapSyntaxNode (#35991)

Closes #35932
Closes #35933

I only intended to fix multi select in this, I accidentally drive-by
fixed the VIM issue as well. `replace_text_in_range` which I was using
before has two, to me unexpected, side-effects:
- it no-ops when input is disabled, which is the case in VIM's
Insert/Visual modes
- it takes the current selection into account, and does not just operate
on the given range (which I erroneously assumed before)

Now the code is using `buffer.edit` instead, which seems more lower
level, and does not have those side-effects. I was enthused to see that
it accepts a vec of edits, so I didn't have to calculate offsets for
following edits... until I also wanted to set selections, where I do
need to do it by hand. I'm still wondering if there is a simpler way to
do it, but for now it at least passes my muster

Release Notes:

- Added multiple selection support to UnwrapSyntaxNode action
- Fixed UnwrapSyntaxNode not working in VIM Insert/Visual modes
```

## Parents

- [9e0e233319d06956bb28fb0609bb843e89d1a812](https://git.cafe/gitcafe/zed/commit/9e0e233319d06956bb28fb0609bb843e89d1a812?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/bb640c6a1c8b77031b8aabf1d5100945bf1d00ff?format=markdown)
