# Add support for auto surround \(\#13217\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 95b06097ee85d773fd7726e0c89206fdc5554c3c

Requested commit: 95b06097ee85d773fd7726e0c89206fdc5554c3c

Commit: 95b06097ee85d773fd7726e0c89206fdc5554c3c

Tree: b8378a258f6eaa60615bde8e0f2b6bb552963a1b

Author: ᴀᴍᴛᴏᴀᴇʀ

Committer: GitHub

## Message

```
Add support for auto surround (#13217)

![result](https://github.com/zed-industries/zed/assets/32017007/c400081f-be5d-48fa-994f-90a00e2be359)

In the past, Zed used a single switch called `autoclose` to control both
`autoclose` and `auto_surround` functionalities:
+ `autoclose`: when input '(', append ')' automatically.
+ `auto_surround`: when select text and input '(', surround text with
'(' and ')' automatically.

This PR separates `auto_surround` from `autoclose` to support `<`. 

Previously, if `autoclose` of `<` was set to `false`, `auto_surround`
couldn't be used. However, setting `autoclose` to `true` would affect
the default behavior of simple expression. For example, `a < b` would
become `a <> b`.

For more information, see #13187.

Fix #12898.

Release Notes:

- Added support for `auto_surround`
([#12898](https://github.com/zed-industries/zed/issues/12898)).
```

## Parents

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

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