From 807cb4dd9173e74371d8ec20a6205012f7c3aeaa Mon Sep 17 00:00:00 2001 From: Oliver <480930+rivo@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:54:15 +0100 Subject: [PATCH] Hiding autocomplete drop-down upon blur. Fixes #792 --- inputfield.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inputfield.go b/inputfield.go index a8a05da..5ee009d 100644 --- a/inputfield.go +++ b/inputfield.go @@ -403,6 +403,12 @@ func (i *InputField) SetFinishedFunc(handler func(key tcell.Key)) FormItem { return i } +// Blur is called when this primitive loses focus. +func (i *InputField) Blur() { + i.Box.Blur() + i.autocompleteList = nil // Hide the autocomplete drop-down. +} + // Draw draws this primitive onto the screen. func (i *InputField) Draw(screen tcell.Screen) { i.Box.DrawForSubclass(screen, i)