New excerpt controls (#24428)

Release Notes:

- Multibuffers now use less vertical space for excerpt boundaries.
Additionally the expand up/down arrows are hidden at the start and end
of the buffers

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
Co-authored-by: Zed AI <claude-3.5-sonnet@zed.dev>
This commit is contained in:
Conrad Irwin 2025-03-13 15:52:47 -06:00 committed by GitHub
parent 3935e8343a
commit e3c0f56a96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 513 additions and 707 deletions

View file

@ -1075,45 +1075,36 @@ impl OutlinePanel {
});
} else {
let mut offset = Point::default();
let show_excerpt_controls = active_editor
.read(cx)
.display_map
.read(cx)
.show_excerpt_controls();
let expand_excerpt_control_height = 1.0;
if let Some(buffer_id) = scroll_to_buffer {
let current_folded = active_editor.read(cx).is_buffer_folded(buffer_id, cx);
if current_folded {
if show_excerpt_controls {
let previous_buffer_id = self
.fs_entries
.iter()
.rev()
.filter_map(|entry| match entry {
FsEntry::File(file) => Some(file.buffer_id),
FsEntry::ExternalFile(external_file) => {
Some(external_file.buffer_id)
}
FsEntry::Directory(..) => None,
})
.skip_while(|id| *id != buffer_id)
.nth(1);
if let Some(previous_buffer_id) = previous_buffer_id {
if !active_editor
.read(cx)
.is_buffer_folded(previous_buffer_id, cx)
{
offset.y += expand_excerpt_control_height;
let previous_buffer_id = self
.fs_entries
.iter()
.rev()
.filter_map(|entry| match entry {
FsEntry::File(file) => Some(file.buffer_id),
FsEntry::ExternalFile(external_file) => {
Some(external_file.buffer_id)
}
FsEntry::Directory(..) => None,
})
.skip_while(|id| *id != buffer_id)
.nth(1);
if let Some(previous_buffer_id) = previous_buffer_id {
if !active_editor
.read(cx)
.is_buffer_folded(previous_buffer_id, cx)
{
offset.y += expand_excerpt_control_height;
}
}
} else {
if multi_buffer_snapshot.as_singleton().is_none() {
offset.y = -(active_editor.read(cx).file_header_size() as f32);
}
if show_excerpt_controls {
offset.y -= expand_excerpt_control_height;
}
offset.y -= expand_excerpt_control_height;
}
}
active_editor.update(cx, |editor, cx| {