From bc39ed2575f141cbbb9bbe2fe0c7decdc852d7f4 Mon Sep 17 00:00:00 2001 From: Ratazzi Date: Mon, 6 Oct 2025 22:58:46 +0800 Subject: [PATCH] editor: Preserve font features for vim block cursor (#39474) ## Summary Fixes an issue where font features (like ligatures) were not applied to text under the vim block cursor. The cursor would inherit the font family from the character at the cursor position, but would use default font features instead of the editor's configured font features. ## Changes - Make the font mutable when rendering the vim block cursor - Apply the editor's text style font features to the cursor font This ensures that text under the block cursor renders with the same visual appearance as the rest of the editor content. Closes #39471 Release Notes: - Fixed vim block cursor not respecting font features (like ligatures) --- crates/editor/src/element.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 2dcb1a8c4b42a932c84802290b50f6b2ed370b38..479f7ef04c677ef322f7758a95b9e8b875aabad8 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1625,12 +1625,13 @@ impl EditorElement { .map(|text| { let len = text.len(); - let font = cursor_row_layout + let mut font = cursor_row_layout .font_id_for_index(cursor_column) .and_then(|cursor_font_id| { window.text_system().get_font_for_id(cursor_font_id) }) .unwrap_or(self.style.text.font()); + font.features = self.style.text.font_features.clone(); // Invert the text color for the block cursor. Ensure that the text // color is opaque enough to be visible against the background color.