# editor: Do not run brace completion on empty text\. \(\#2965\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 1eb74acb3ecc474163b52b564f8071df0525a579

Requested commit: 1eb74acb3ecc474163b52b564f8071df0525a579

Commit: 1eb74acb3ecc474163b52b564f8071df0525a579

Tree: e12527ccf3aec5d497081fda947491e593a39763

Author: Piotr Osiewicz

Committer: GitHub

## Message

```
editor: Do not run brace completion on empty text. (#2965)

Users of keyboard layout with IME complained about the peculiar
behaviour where typing in "sss" and then removing all of it left behind
one 's' and also appended a closing brace. This was not reproducible on
a buffer without language, so I've suspected that brace insertion might
be a problem here. For whatever reason when the user removes the last
character from a run that triggered IME, we receive a notification about
an empty insertion. Sadly, brace completion does not handle an empty
input properly and we erroneously insert a closing brace when deleting
the followup characters. In fact, the brace inserted is always the
closing brace for the first entry in language's config.toml 'brackets'
field (see Scheme vs Markdown). This guard also allows for the proper
removal of the first character.

Closes community tickets zed-industries/community#877
zed-industries/community#1329

Z-2869

Release Notes:
- Fixed handling of bracket completion for international keyboard
layouts that use IME. This led to Zed erroneously inserting the `}`
character while removing the first character that triggered IME.
```

## Parents

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

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