Remove previous multi buffer hardcode from the outline panel (#32321)

Closes https://github.com/zed-industries/zed/issues/32316

Multi buffer design was changed so that control buttons are not
occupying extra lines, the hardcoded logic for that is obsolete thus
removed.

Release Notes:

- Fixed incorrect offsets during outline panel navigation in singleton
buffers
This commit is contained in:
Kirill Bulatov 2025-06-08 02:54:47 +03:00 committed by GitHub
parent cabd22f36b
commit 5187954711
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1107,38 +1107,14 @@ impl OutlinePanel {
});
} else {
let mut offset = Point::default();
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 {
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);
}
offset.y -= expand_excerpt_control_height;
if multi_buffer_snapshot.as_singleton().is_none()
&& !active_editor.read(cx).is_buffer_folded(buffer_id, cx)
{
offset.y = -(active_editor.read(cx).file_header_size() as f32);
}
}
active_editor.update(cx, |editor, cx| {
editor.set_scroll_anchor(ScrollAnchor { offset, anchor }, window, cx);
});