From f21a357f763732f80691c3b640d698b067b16c6e Mon Sep 17 00:00:00 2001 From: Rocky Shi Date: Sat, 24 Jan 2026 21:55:53 +1300 Subject: [PATCH] Hide block cursor text when the cursor is within a redacted range (#45549) Closes [#ISSUE](https://github.com/zed-industries/zed/issues/20696) Release Notes: - Hide block cursor text when the cursor is within a redacted range Screenshot: image --- crates/editor/src/element.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 471af3741b95acf0578e0efe8e218288e2368379..dc37965779cc70ed8177c720b38dbc530c4ab6b6 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1797,6 +1797,7 @@ impl EditorElement { em_width: Pixels, em_advance: Pixels, autoscroll_containing_element: bool, + redacted_ranges: &[Range], window: &mut Window, cx: &mut App, ) -> Vec { @@ -1832,7 +1833,10 @@ impl EditorElement { if block_width == Pixels::ZERO { block_width = em_advance; } - let block_text = if let CursorShape::Block = selection.cursor_shape { + let block_text = if selection.cursor_shape == CursorShape::Block + && !redacted_ranges.iter().any(|range| { + range.start <= cursor_position && cursor_position < range.end + }) { snapshot .grapheme_at(cursor_position) .or_else(|| { @@ -10484,6 +10488,7 @@ impl Element for EditorElement { em_width, em_advance, autoscroll_containing_element, + &redacted_ranges, window, cx, );