Patch #2028 2007-05-30 22:35

pauliusz

Find in modified files [ Bug #10527 ]
Download
2028-Find_in_modifi.patch (1.8 KB)
Category
Application::Bugfix
Status
Accepted
Close date
2007-06-01 15:51
Assigned to
biplab
Index: src/sdk/editormanager.cpp
===================================================================
--- src/sdk/editormanager.cpp    (revision 4013)
+++ src/sdk/editormanager.cpp    (working copy)
@@ -2144,6 +2144,9 @@
 
 int EditorManager::FindInFiles(cbFindReplaceData* data)
 {
+    if (!data || data->findText.IsEmpty())
+        return 0;
+
     // clear old search results
     if ( data->delOldSearches )
     {
@@ -2151,9 +2154,6 @@
     }
     int oldcount = m_pSearchLog->GetListControl()->GetItemCount();
 
-    if (!data || data->findText.IsEmpty())
-        return 0;
-
     // let's make a list of all the files to search in
     wxArrayString filesList;
 
@@ -2251,8 +2251,8 @@
         return 0;
     }
 
-    // now that are list is filled, we 'll search
-    // but first we 'll create a hidden cbStyledTextCtrl to do the search for us ;)
+    // now that list is filled, we'll search
+    // but first we'll create a hidden cbStyledTextCtrl to do the search for us ;)
     cbStyledTextCtrl* control = new cbStyledTextCtrl(m_pNotebook, -1, wxDefaultPosition, wxSize(0, 0));
     control->Show(false); //hidden
 
@@ -2285,9 +2285,14 @@
         // re-initialize the find struct for every file searched
         *data = localData;
 
-        // first load the file in the control
-        if (!control->LoadFile(filesList[i]))
+        // check if the file is already opened in built-in editor and do search in it
+        cbEditor* ed = IsBuiltinOpen(filesList[i]);
+        if (ed)
         {
+            control->SetText(ed->GetControl()->GetText());
+        }
+        else if (!control->LoadFile(filesList[i])) // else load the file in the control
+        {
             //            LOGSTREAM << _("Failed opening ") << filesList[i] << wxT('\n');
             continue; // failed
         }
biplab 2007-06-01 15:51

Thanks for your patch. :-)