From 743165fa6c5c46d2dab907bc0122f18e1465b7b2 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Wed, 20 Nov 2024 14:38:56 +0100 Subject: [PATCH] Fix assistant hints showing up when selecting \n in Vim mode (#20899) We also need to check whether the selection is empty, not just whether its head is on an empty line. Release Notes: - N/A Co-authored-by: Antonio --- crates/editor/src/editor.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index d303ecf0f3..7f31cdedd3 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -11875,7 +11875,15 @@ impl Editor { style: &EditorStyle, cx: &mut WindowContext, ) -> Option { - if !self.newest_selection_head_on_empty_line(cx) || self.has_active_inline_completion(cx) { + let selection = self.selections.newest::(cx); + if !selection.is_empty() { + return None; + }; + + let snapshot = self.buffer.read(cx).snapshot(cx); + let buffer_row = MultiBufferRow(selection.head().row); + + if snapshot.line_len(buffer_row) != 0 || self.has_active_inline_completion(cx) { return None; }