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 18:55:10 +02:00 committed by GitHub
parent f859b328f0
commit 76871056f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 299 additions and 617 deletions

View file

@ -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