From c3c09e871a59d4c7b3173f8cc98b70c426dcf529 Mon Sep 17 00:00:00 2001 From: Nikolay Borodin Date: Sat, 1 Jun 2024 03:17:10 +0200 Subject: [PATCH] Improved the search box event handling --- src/multimenu.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/multimenu.cpp b/src/multimenu.cpp index be9545dca5a..cd690337b86 100644 --- a/src/multimenu.cpp +++ b/src/multimenu.cpp @@ -483,9 +483,13 @@ void addMultiRequest(const char *searchDir, const char *fileExtension, UDWORD mo searchBox->setPlaceholder(_("Search for map")); searchBox->setString(WzString::fromUtf8(current_searchString)); - searchBox->setOnReturnHandler([searchDir, fileExtension, mode, numPlayers](W_EDITBOX& widg) { + searchBox->setOnEditingStoppedHandler([searchDir, fileExtension, mode, numPlayers](W_EDITBOX& widg) { + const std::string &value = widg.getString().toUtf8(); + if (value == current_searchString) { + return; + } closeMultiRequester(); - addMultiRequest(searchDir, fileExtension, mode, numPlayers, widg.getString().toUtf8()); + addMultiRequest(searchDir, fileExtension, mode, numPlayers, value); }); multiRequestUp = true;