From 91d47e1cd07a663c2589e740a4584542ec16c84e Mon Sep 17 00:00:00 2001 From: liam Date: Tue, 12 May 2026 16:06:01 -0400 Subject: [PATCH] Clip flex editor blocks to the text viewport (#56549) Resolves https://github.com/zed-industries/zed/issues/56518 This diff fixes code lens decorations continuing to paint into the gutter when the editor is horizontally scrolled. Code lens entries were rendered as flex editor blocks with explicit gutter padding, which allowed them to bypass the text viewport clipping used by content-only blocks. With this change, code lens entries render as spacer-style custom blocks instead. Spacer blocks already scroll with buffer content and paint through the text-side mask, so the code lens padding can be relative to the editor text area and decorations clip at the left edge of the viewport. | Before | After | | --- | --- | | | | Release Notes: - Fixed code lens decorations painting outside the editor viewport when horizontally scrolling. --- crates/editor/src/code_lens.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/editor/src/code_lens.rs b/crates/editor/src/code_lens.rs index c78620e25fda43..fed3f054fe2bcb 100644 --- a/crates/editor/src/code_lens.rs +++ b/crates/editor/src/code_lens.rs @@ -345,7 +345,7 @@ impl Editor { let props = BlockProperties { placement: BlockPlacement::Above(anchor), height: Some(1), - style: BlockStyle::Flex, + style: BlockStyle::Spacer, render: build_code_lens_renderer(new_line.clone(), editor_handle.clone()), priority: 0, }; @@ -633,7 +633,7 @@ fn build_code_lens_renderer(line: CodeLensLine, editor: WeakEntity) -> R div() .id(cx.block_id) - .pl(cx.margins.gutter.full_width() + cx.em_width * (line.indent_column as f32 + 0.5)) + .pl(cx.em_width * (line.indent_column as f32 + 0.5)) .h_full() .flex() .flex_row()