Ver Fonte

Bug fix: Pressing Tab during incremental search on Login dialog never look into collapsed folders when more than one visible node matched the search

Source commit: 0a50a7b2c3d08101f5c40aebe5d6f9b134910e22
Martin Prikryl há 2 anos atrás
pai
commit
abb0f7575e
2 ficheiros alterados com 11 adições e 8 exclusões
  1. 10 6
      source/forms/Login.cpp
  2. 1 2
      source/forms/Login.h

+ 10 - 6
source/forms/Login.cpp

@@ -924,7 +924,7 @@ void __fastcall TLoginDialog::SessionTreeKeyPress(TObject * /*Sender*/, System::
       {
         Configuration->Usage->Inc(L"SiteIncrementalSearches");
       }
-      if (!SitesIncrementalSearch(FSitesIncrementalSearch + Key, false, false))
+      if (!SitesIncrementalSearch(FSitesIncrementalSearch + Key, false, false, false))
       {
         MessageBeep(MB_ICONHAND);
       }
@@ -942,7 +942,7 @@ void __fastcall TLoginDialog::SessionTreeKeyPress(TObject * /*Sender*/, System::
         {
           UnicodeString NewText =
             FSitesIncrementalSearch.SubString(1, FSitesIncrementalSearch.Length() - 1);
-          SitesIncrementalSearch(NewText, false, false);
+          SitesIncrementalSearch(NewText, false, false, false);
         }
         Key = 0;
       }
@@ -1676,7 +1676,7 @@ void __fastcall TLoginDialog::CMDialogKey(TWMKeyDown & Message)
     {
       TShiftState Shift = KeyDataToShiftState(Message.KeyData);
       bool Reverse = Shift.Contains(ssShift);
-      if (!SitesIncrementalSearch(FSitesIncrementalSearch, true, Reverse))
+      if (!SitesIncrementalSearch(FSitesIncrementalSearch, true, Reverse, true))
       {
         MessageBeep(MB_ICONHAND);
       }
@@ -2761,10 +2761,14 @@ void __fastcall TLoginDialog::ResetSitesIncrementalSearch()
   }
 }
 //---------------------------------------------------------------------------
-bool __fastcall TLoginDialog::SitesIncrementalSearch(const UnicodeString & Text,
-  bool SkipCurrent, bool Reverse)
+bool __fastcall TLoginDialog::SitesIncrementalSearch(
+  const UnicodeString & Text, bool SkipCurrent, bool Reverse, bool Expanding)
 {
-  TTreeNode * Node = SearchSite(Text, false, SkipCurrent, Reverse);
+  TTreeNode * Node = NULL;
+  if (!Expanding)
+  {
+    Node = SearchSite(Text, false, SkipCurrent, Reverse);
+  }
   if (Node == NULL)
   {
     Node = SearchSite(Text, true, SkipCurrent, Reverse);

+ 1 - 2
source/forms/Login.h

@@ -374,8 +374,7 @@ private:
   inline TSessionData * __fastcall GetNodeSession(TTreeNode * Node);
   void __fastcall ReloadSessions(const UnicodeString & SelectSite);
   void __fastcall ResetSitesIncrementalSearch();
-  bool __fastcall SitesIncrementalSearch(const UnicodeString & Text,
-    bool SkipCurrent, bool Reverse);
+  bool __fastcall SitesIncrementalSearch(const UnicodeString & Text, bool SkipCurrent, bool Reverse, bool Expanding);
   TTreeNode * __fastcall SearchSite(const UnicodeString & Text,
     bool AllowExpanding, bool SkipCurrent, bool Reverse);
   TTreeNode * __fastcall GetNextNode(TTreeNode * Node, bool Reverse);