Fix assistant hints showing up when selecting \n in Vim mode (#20899)

Thorsten Ball and Antonio created

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 <antonio@zed.dev>

Change summary

crates/editor/src/editor.rs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

Detailed changes

crates/editor/src/editor.rs 🔗

@@ -11875,7 +11875,15 @@ impl Editor {
         style: &EditorStyle,
         cx: &mut WindowContext,
     ) -> Option<AnyElement> {
-        if !self.newest_selection_head_on_empty_line(cx) || self.has_active_inline_completion(cx) {
+        let selection = self.selections.newest::<Point>(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;
         }