# solo_diff_view: Show changes only by default \(\#59958\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 5fa184f8b63df7e084140ab3c2a91b4a6f262bab

Requested commit: 5fa184f8b63df7e084140ab3c2a91b4a6f262bab

Commit: 5fa184f8b63df7e084140ab3c2a91b4a6f262bab

Tree: 452ac33745e611a3d4372db96de765279c4ac92f

Author: Sathwik Chirivelli

Committer: GitHub

## Message

```
solo_diff_view: Show changes only by default (#59958)

# Objective

- Default the solo diff view to show changed hunks with excerpted
context instead of expanding the entire file.
- Closes https://github.com/zed-industries/zed/issues/59489

## Solution

- Initialize the solo diff editor with excerpts around changed hunks.
- Add a header toggle for switching between the excerpted changes-only
view and the full-file view.
- Keep both sides of the split diff visually aligned when excerpts are
collapsed.

## Testing

- `cargo check -p git_ui`
- `cargo test -p git_ui`

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

<details>
  <summary>Click to view showcase</summary>

Changes-only default view:
<img width="1624" height="1030"
alt="solo_diff_view_new_default_changes_only_view"
src="https://github.com/user-attachments/assets/c6fb937e-8882-415c-8476-b9c3019c152e"
/>


Toggled full-file view:
<img width="1624" height="1030"
alt="solo_diff_view_toggled_to_full_file_view"
src="https://github.com/user-attachments/assets/3d736d00-178a-4dfa-b1ff-d3d15e33b30e"
/>

</details>

---

Release Notes:

- Improved solo diff view to show changed hunks by default with a toggle
for viewing the full file.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
```

## Parents

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

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