From 675ed70f59483cfe7d07e0f90dc487ec02e65c68 Mon Sep 17 00:00:00 2001
From: Sathwik Chirivelli <146921254+chirivelli@users.noreply.github.com>
Date: Thu, 7 May 2026 20:51:08 +0530
Subject: [PATCH] Fix multibuffer initialization based on RHS state (#56058)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This update modifies the initialization of the left-hand side
multibuffer in the SplittableEditor. It now checks if the right-hand
side multibuffer is a singleton and uses a
`MultiBuffer::without_headers` instead.
Before Screenshot:
After Screenshot:
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
Release Notes:
- Optimized multibuffer creation by conditionally using headers based on
RHS state.
---
crates/editor/src/split.rs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/crates/editor/src/split.rs b/crates/editor/src/split.rs
index 8f7ef224c5338851373724a1c4b794757fc154a5..39c450fb9598f76909ea8e210bebdce44982a034 100644
--- a/crates/editor/src/split.rs
+++ b/crates/editor/src/split.rs
@@ -583,8 +583,13 @@ impl SplittableEditor {
};
let project = workspace.read(cx).project().clone();
+ let is_rhs_singleton = self.rhs_multibuffer.read(cx).is_singleton();
let lhs_multibuffer = cx.new(|cx| {
- let mut multibuffer = MultiBuffer::new(Capability::ReadOnly);
+ let mut multibuffer = if is_rhs_singleton {
+ MultiBuffer::without_headers(Capability::ReadOnly)
+ } else {
+ MultiBuffer::new(Capability::ReadOnly)
+ };
multibuffer.set_all_diff_hunks_expanded(cx);
multibuffer
});