Files
zed/crates
Lukas Wirth ebd80d7995 buffer_diff: Fix panic when staging hunks with stale buffer snapshot (#51641)
When the buffer is edited after the diff is computed but before staging,
anchor positions shift while diff_base_byte_range values don't. If the
primary (HEAD) hunk extends past the unstaged (index) hunk, an edit in
the extension region causes the overshoot calculation to produce an
index_end that exceeds index_text.len(), panicking in
rope::Cursor::suffix.

Fix by clamping index_end to index_text.len(). This is safe because the
computed index text is an optimistic approximation — the real staging
happens at the filesystem level via git add/git reset.

Closes ZED-5R2


Release Notes:

- Fixed a source of panics when staging diff hunks
2026-03-16 09:49:02 +01:00
..
2026-03-11 03:08:39 +00:00
2026-03-12 22:15:12 +00:00
2026-02-26 18:36:50 +01:00
2026-02-12 01:06:23 +00:00