Patch #2227 2007-11-04 15:59

pauliusz

fix CC toolbar cleared when closing not active editor
Download
2227-fix_CC_toolbar.patch (1.4 KB)
Category
Plugin::Bugfix
Status
Accepted
Close date
2007-11-05 08:45
Assigned to
 
Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp    (revision 4596)
+++ src/plugins/codecompletion/codecompletion.cpp    (working copy)
@@ -1406,17 +1406,24 @@
 
 void CodeCompletion::OnEditorClosed(CodeBlocksEvent& event)
 {
-    // clear toolbar when closing editor
-    m_Function->Clear();
-    cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinEditor(event.GetEditor());
-    wxString filename(wxEmptyString);
-    if(ed)
-        filename = ed->GetFilename();
+    EditorManager* edm = Manager::Get()->GetEditorManager();
 
-    m_AllFunctionsScopes[filename].m_FunctionsScope.clear();
-    m_AllFunctionsScopes[filename].m_NameSpaces.clear();
-    m_AllFunctionsScopes[filename].parsed = false;
+    // we need to clear CC toolbar only when we are closing last editor
+    // in other situations OnEditorActivated does this job
+    if(edm->GetEditorsCount() == 1)
+    {
+        // clear toolbar when closing last editor
+        m_Function->Clear();
+        cbEditor* ed = edm->GetBuiltinEditor(event.GetEditor());
+        wxString filename(wxEmptyString);
+        if(ed)
+            filename = ed->GetFilename();
 
+        m_AllFunctionsScopes[filename].m_FunctionsScope.clear();
+        m_AllFunctionsScopes[filename].m_NameSpaces.clear();
+        m_AllFunctionsScopes[filename].parsed = false;
+    }
+
     event.Skip();
 }
 
pauliusz 2007-11-04 16:19