# Fix a bug where the IME pre-edit would desync from Zed \(\#12651\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 1a0708f28cf302a0fe726a82b8cba63b839076cb

Requested commit: 1a0708f28cf302a0fe726a82b8cba63b839076cb

Commit: 1a0708f28cf302a0fe726a82b8cba63b839076cb

Tree: 463e37fe297b03da5b51bf12818cb5f75a099169

Author: Mikayla Maki

Committer: GitHub

## Message

```
Fix a bug where the IME pre-edit would desync from Zed (#12651)

fixes #11829 

In https://github.com/zed-industries/zed/pull/7494, we introduced IME
event buffering, so that we could preempt the IME with a keystroke event
in some cases. However, this caused a desynchronization bug in long
multi-step IME composition, such as the pre-edit used in the Japanese
Romaji keyboard (and other languages). We found that this was due to the
IME issuing actions, and then immediately querying the editor's state
before we had applied those actions. Therefore, this PR removes IME
action buffering.

We have tested all of the cases in the `handle_key_event` documentation
and added a few of our own.

Release Notes:

- Fixed an issue where the IME pre-edit could desynchronize from the
editor on macOS
([#11829](https://github.com/zed-industries/zed/pull/12651))

---------

Co-authored-by: Jan Solanti <jhs@psonet.com>
```

## Parents

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

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