# Redraw when toggling between windows \(\#9236\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 3c28282108caed3bb88bfde1da7ce1a7591500eb

Requested commit: 3c28282108caed3bb88bfde1da7ce1a7591500eb

Commit: 3c28282108caed3bb88bfde1da7ce1a7591500eb

Tree: 9ddb4204ee190bd9e0d70cf61dc79de9c07db2ca

Author: Thorsten Ball

Committer: GitHub

## Message

```
Redraw when toggling between windows (#9236)

Before this change we didn't consistently trigger focus events when
toggling between with windows `Cmd-backtick`. We only triggered them
when the OS decided to trigger a redraw.

That lead to a nasty bug that showed up in Vim mode where a cursor would
still be active in the hidden window, even though it was deactivated.

One then had to manually try to trigger a focus event in the new window
to activate the cursor.

With this change, we call `cx.refresh` when the window activation status
changed which triggers focus events consistently and fixes this bug.

With logging we can observe this:

**BEFORE**:


https://github.com/zed-industries/zed/assets/1185253/e1ad8878-129c-44ba-9d8b-c720f9dca5b6


**AFTER**:


https://github.com/zed-industries/zed/assets/1185253/733fdadb-d1ea-47fe-a2c1-7b50af299cc0


Release Notes:

- Fixed focus not being consistently changed when switching between
multiple Zed windows via `Cmd-backtick`.

---------

Co-authored-by: Manu Raj <git@manuraj.dev>
Co-authored-by: Antonio <antonio@zed.dev>
```

## Parents

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

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