# Fix Wayland keyrepeat getting cancelled by unrelated keyup \(\#11052\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 393b16d2262d6bf94ea0ea9c982ab2b1c2736fae

Requested commit: 393b16d2262d6bf94ea0ea9c982ab2b1c2736fae

Commit: 393b16d2262d6bf94ea0ea9c982ab2b1c2736fae

Tree: e3ca09c33e38392b169033d5c2fdf2ac29665a13

Author: Jakob Hellermann

Committer: GitHub

## Message

```
Fix Wayland keyrepeat getting cancelled by unrelated keyup (#11052)

fixes #11048

## Problem
in the situation `press right`, `press left`, `release right` the
following happens right now:

- `keypressed right`, `current_keysym` is set to `right`
- `keypressed left`, `current_keysym` is set to `left`

the repeat timer runs asynchronously and emits keyrepeats since
`current_keysym.is_some()`

- `keyreleased right`, `current_keysym` is set to None

the repeat timer no longer emits keyrepeats

- `keyreleased left`, this is where `current_keysym` should actually be
set to None.

## Solution
Only reset `current_keysym` if the released key matches the last pressed
key.

Release Notes:

- N/A
```

## Parents

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

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