# Combine multiple buffer update count fields into one \(\#13449\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 98132978925c7a2363d8096a9246b808d64a0c90

Requested commit: 98132978925c7a2363d8096a9246b808d64a0c90

Commit: 98132978925c7a2363d8096a9246b808d64a0c90

Tree: 55b625928c0e01a93510118545b6bd54c06e4e6b

Author: Max Brunsfeld

Committer: GitHub

## Message

```
Combine multiple buffer update count fields into one (#13449)

Buffers carry several pieces of state besides their text: syntax tree,
diagnostics, git diff, and file data. Previously, the buffer maintained
a separate integer version number for each of these four pieces of
state, incrementing it every time that piece of state is updated. This
is used by MultiBuffers to detect when they need to update excerpts.

Previously, for a given buffer, these four version numbers were stored
on the buffer itself, on every snapshot of the buffer, in any
multi-buffer that referenced that buffer, **and** on snapshots of that
multi-buffer. But the only use for the version numbers was reduced down
to a single boolean predicate: whether or not the buffer's state has
changed.

In this PR, I've combined those 4 version numbers into one. I've called
it `non_text_state_update_count` because it tracks all state updates
outside of the text itself. This removes a bunch of unnecessary code,
and reduces the size of buffer snapshots and multi-buffer snapshots.

Release Notes:

- N/A
```

## Parents

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

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