Preserve cursor position when resetting excerpts (#27850)

Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Antonio Scandurra
2025-04-01 16:55:10 +00:00
committed by GitHub
co-authored by Nathan Sobo Conrad Irwin
parent f859b328f0
commit 76871056f5
19 changed files with 299 additions and 617 deletions
@@ -729,18 +729,12 @@ mod tests {
let mut multibuffer = MultiBuffer::new(language::Capability::ReadWrite);
multibuffer.push_excerpts(
buffer_1.clone(),
[ExcerptRange {
context: Point::new(0, 0)..Point::new(2, 0),
primary: None,
}],
[ExcerptRange::new(Point::new(0, 0)..Point::new(2, 0))],
cx,
);
multibuffer.push_excerpts(
buffer_2.clone(),
[ExcerptRange {
context: Point::new(0, 0)..Point::new(2, 0),
primary: None,
}],
[ExcerptRange::new(Point::new(0, 0)..Point::new(2, 0))],
cx,
);
multibuffer
@@ -981,18 +975,12 @@ mod tests {
let mut multibuffer = MultiBuffer::new(language::Capability::ReadWrite);
multibuffer.push_excerpts(
private_buffer.clone(),
[ExcerptRange {
context: Point::new(0, 0)..Point::new(1, 0),
primary: None,
}],
[ExcerptRange::new(Point::new(0, 0)..Point::new(1, 0))],
cx,
);
multibuffer.push_excerpts(
public_buffer.clone(),
[ExcerptRange {
context: Point::new(0, 0)..Point::new(6, 0),
primary: None,
}],
[ExcerptRange::new(Point::new(0, 0)..Point::new(6, 0))],
cx,
);
multibuffer