# editor: Fix auto-closing quotes after word character \(\#26803\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 3ad9074e637685497d8c75b4974653b7dca607fe

Requested commit: 3ad9074e637685497d8c75b4974653b7dca607fe

Commit: 3ad9074e637685497d8c75b4974653b7dca607fe

Tree: 02f0fe31de1963eb038037f7d7c166e894c59e82

Author: Smit Barmase

Committer: GitHub

## Message

````
editor: Fix auto-closing quotes after word character (#26803)

Closes #14349

When typing quotes immediately after a word character, it resulted in
auto-closing the quote.

```js
const thing = this is text^;
```

Typing a quote resulted in `this is text""^;` which is not correct, and
should be `this is text"^;`.

This PR changes logic for auto close:

1. We now prevent auto-closing in case of brackets where start == end
when they're typed immediately after a word character. i.e. For, ``` `,
", ' ```.
2. Other bracket pairs like `{}, (), etc` continue to auto-close
regardless of preceding character. So, `func^` to `func()^` will keep
working.
3. Auto-closing in other contexts like after spaces, punctuation, etc.
will still work.

Before:

![before](https://github.com/user-attachments/assets/6be02c95-4c71-488b-901d-b7b98c4170a4)

After:

![after](https://github.com/user-attachments/assets/680ece4d-20cb-428c-b430-846da3a2d643)

Release Notes:

- Fixed auto-paired quotes being inserted when typing a quote
immediately next to a word character.
````

## Parents

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

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