From 456fdd8f932dfa4e3bb61ab24678ae229d457eec Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 27 Jan 2018 01:18:21 +0100 Subject: [PATCH] Always update dynamic completions when the text changes Don't do it only when the text entry is (or becomes again) empty, this breaks dynamic completers such as the one used in the widgets sample, which determines its completions depending on the already entered text (of course, the sample example is not particularly useful, as the completions are always the same, but it's supposed to show that they could dynamically depend on the already entered part of the string). --- src/gtk/textentry.cpp | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/gtk/textentry.cpp b/src/gtk/textentry.cpp index 9f17072503..a65822ffea 100644 --- a/src/gtk/textentry.cpp +++ b/src/gtk/textentry.cpp @@ -363,26 +363,12 @@ private: { m_completer = NULL; - m_newCompletionsNeeded = m_entry->IsEmpty(); - win->Bind(wxEVT_TEXT, &wxTextAutoCompleteDynamic::OnEntryChanged, this); } - // for a given prefix, if DoUpdateCompletionModel() succeeds, - // we won't do any further update of the model as long as we - // do not clear the textentry. but then we have to start over again. - - void OnEntryChanged( wxCommandEvent& event ) + void OnEntryChanged(wxCommandEvent& event) { - if ( event.GetString().empty() ) - { - m_newCompletionsNeeded = true; - } - else - { - if ( m_newCompletionsNeeded ) - DoUpdateCompletionModel(); - } + DoUpdateCompletionModel(); event.Skip(); } @@ -406,8 +392,6 @@ private: } UseModel(store); - - m_newCompletionsNeeded = false; } else { @@ -422,12 +406,6 @@ private: // The associated window, we need to store it to unbind our event handler. wxWindow* const m_win; - // Each time we enter a new prefix, GtkEntryCompletion needs to be fed with - // new completions. And this flag lets us try to DoUpdateCompletionModel() - // and if it succeeds, it'll set the flag to false and OnEntryChanged() - // will not try to call it again unless we entered a new prefix. - bool m_newCompletionsNeeded; - wxDECLARE_NO_COPY_CLASS(wxTextAutoCompleteDynamic); };