Ver Fonte

Split processing autocomplete and drawing it (#3662)

Thomas Nind há 11 meses atrás
pai
commit
f9a1d0345e
1 ficheiros alterados com 15 adições e 3 exclusões
  1. 15 3
      Terminal.Gui/Views/TextField.cs

+ 15 - 3
Terminal.Gui/Views/TextField.cs

@@ -1016,8 +1016,7 @@ public class TextField : View
 
         RenderCaption ();
 
-        ProcessAutocomplete ();
-
+        DrawAutocomplete ();
         _isDrawing = false;
     }
 
@@ -1767,8 +1766,21 @@ public class TextField : View
             return;
         }
 
-        // draw autocomplete
         GenerateSuggestions ();
+    }
+
+    private void DrawAutocomplete ()
+    {
+
+        if (SelectedLength > 0)
+        {
+            return;
+        }
+
+        if (Autocomplete?.Context == null)
+        {
+            return;
+        }
 
         var renderAt = new Point (
                                   Autocomplete.Context.CursorPosition,