# Fix surrounding text with bracket pairs with multiple selections · gitcafe/zed

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

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

Visibility: public

Requested revision: 7a81983c62f3f1253d1b6f48310b12e8612f38bb

Requested commit: 7a81983c62f3f1253d1b6f48310b12e8612f38bb

Commit: 7a81983c62f3f1253d1b6f48310b12e8612f38bb

Tree: 19b87011ac7b14470654c46186d4796011024d02

Author: Antonio Scandurra

Committer: Antonio Scandurra

## Message

```
Fix surrounding text with bracket pairs with multiple selections

This was probably a regression that was introduced with the new batched
`Buffer::edit` API and was caused by providing selection ranges in a
non-ordered fashion (we were passing all the starts first and then all the
ends).

With this commit we are adding a unit test to verify the behavior of
`Editor::surround_with_bracket_pair` and changing the order in which
we pass edit ranges to respect the selection order.

```

## Parents

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

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