After a tag search, scroll the list so we can see the best results.
authorCarl Hetherington <cth@carlh.net>
Wed, 17 Mar 2021 19:14:24 +0000 (20:14 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 17 Mar 2021 19:14:55 +0000 (20:14 +0100)
Otherwise if you search when the list is scrolled down you wonder
why you aren't seeing the results you expect from the search.

src/wx/language_tag_dialog.cc

index e0f6ef883b7d9eabc9c90306bcd8c5318c9f3c11..6968b1911b6868e3bfa3bcdb66b8c18d05b452c9 100644 (file)
@@ -159,7 +159,7 @@ public:
        optional<dcp::LanguageTag::RegionSubtag> get () const
        {
                if (!_list->selected_subtag()) {
-                       return optional<dcp::LanguageTag::RegionSubtag>();
+                       return {};
                }
 
                return dcp::LanguageTag::RegionSubtag(_list->selected_subtag()->subtag);
@@ -171,7 +171,11 @@ public:
 private:
        void search_changed ()
        {
-               _list->set_search (_search->GetValue().ToStdString());
+               auto search = _search->GetValue();
+               _list->set_search (search.ToStdString());
+               if (search.Length() > 0) {
+                       _list->EnsureVisible (0);
+               }
                SearchChanged (_search->GetValue().ToStdString());
        }