# Rework frame rendering \(\#3531\) · gitcafe/zed

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

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

Visibility: public

Requested revision: cbd1ce64f796538c4c84c23ebd93c33aecef87aa

Requested commit: cbd1ce64f796538c4c84c23ebd93c33aecef87aa

Commit: cbd1ce64f796538c4c84c23ebd93c33aecef87aa

Tree: 0f3c656ae696b8fb2fdca654d22442c48166aae0

Author: Antonio Scandurra

Committer: GitHub

## Message

```
Rework frame rendering (#3531)

This pull request replaces the old `previous_frame` and `current_frame`
with a new pair of `rendered_frame` and `next_frame` that are swapped
once we are ready to draw a finished frame.

This makes it clearer when to use which: `rendered_frame` should be used
to query the existing state, whereas `next_frame` should be used and
mutated when redrawing a dirty window.

The change was prompted by a bug I encountered in
`FocusHandle::contains`. The implementation was reading `current_frame`,
but that was the wrong field to access if e.g. we were reading it inside
of a `render` function or any other time while drawing the window.

Release Notes:

- N/A
```

## Parents

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

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

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