From f9a1d0345ef0a94bb7804fadca388fa72d758c6b Mon Sep 17 00:00:00 2001 From: Thomas Nind <31306100+tznind@users.noreply.github.com> Date: Wed, 14 Aug 2024 20:19:32 +0100 Subject: [PATCH] Split processing autocomplete and drawing it (#3662) --- Terminal.Gui/Views/TextField.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs index 04995610c..9e4658e57 100644 --- a/Terminal.Gui/Views/TextField.cs +++ b/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,