# gpui: Add character input preference to keystroke events \(\#64859\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 86c20cc9119d89b21ab8ea1cb063f40faa119736

Requested commit: 86c20cc9119d89b21ab8ea1cb063f40faa119736

Commit: 86c20cc9119d89b21ab8ea1cb063f40faa119736

Tree: afe45af8852c95351975a1aa9def753cd4edb418

Author: Smit Barmase

Committer: GitHub

## Message

```
gpui: Add character input preference to keystroke events (#64859)

Adds `KeystrokeEvent::character_input_preferred` so keystroke
interceptors can follow the same text-over-bindings policy as normal
dispatch, which #64803 needs. The field is true when the platform
prefers character input for the key and the focused input handler
accepts text.

For example, with the Polish (Programmers) layout on Windows, AltGr+A
types `ą` but arrives as `ctrl-alt-a`. Normal dispatch already skips the
matching binding when the editor accepts text. Interceptors now get that
information too. It's only a hint: an interceptor can still stop
propagation to take the keystroke instead of letting it type text, e.g.
when recording a keybinding.

The preference is computed before interception, then computed again
right before binding dispatch, because whether the editor accepts text
can change in between:

- An interceptor may turn text input on or off and still let the
keystroke through.
- A pending keystroke that gets replayed may run an action that turns
text input on.

Release Notes:

- N/A
- [GPUI] Added `KeystrokeEvent::character_input_preferred` so keystroke
interceptors can respect text input priority.
```

## Parents

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

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