Bug fixed finally. Known issue reported in last reply has also been fixed. Committed in revision 3671.
I've modified DoFoldLine() SDK function.
I'm not posting the patch.
For your information, the patch I posted in the last thread to quote is different from the patch I've applied in repository. That was the reason I've mentioned that I'm not posting the patch. You may see the diff at the following link.
http://svn.berlios.de/viewcvs/codeblocks?view=rev&rev=3671
I did test your patch. But I couldn't accept it as it works differently than what it is supposed to do. I'm posting your patch in pieces and showing you why it was not accepted.
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp (revision 3455)
+++ src/sdk/cbeditor.cpp (working copy)
@@ -1467,13 +1467,37 @@
void cbEditor::DoFoldBlockFromLine(int line, int fold)
{
- m_pControl->Colourise(0, -1); // the *most* important part!
+ /*m_pControl->Colourise(0, -1); // the *most* important part!
int i = line;
while (i != 0)
{
if (DoFoldLine(i, fold))
return;
--i;
+ }*/
+
+ ConfigManager* mgr = Manager::Get()->GetConfigManager(_T("editor"));
+ if (mgr->ReadBool(_T("/folding/show_folds"), true)) //Only unfold the marked line if the folds are enabled ... duh
+ {
+ m_pControl->Colourise(0, -1); // the *most* important part!
+ int level = m_pControl->GetFoldLevel(line);
+ int parent = m_pControl->GetFoldParent(line);
+
+ //Check for fold headers
+ if ((level & wxSCI_FOLDLEVELHEADERFLAG) && (wxSCI_FOLDLEVELBASE <= (level & wxSCI_FOLDLEVELNUMBERMASK)))
+ parent = line;
+ if (parent != -1)
+ {
+ if (m_pControl->GetFoldExpanded(parent) == false && fold == 0)
+ m_pControl->ToggleFold(parent);
+ else
+ {
+ if (m_pControl->GetFoldExpanded(parent) == true && fold == 1)
+ m_pControl->ToggleFold(parent);
+ else if (fold == 2)
+ m_pControl->ToggleFold(parent);
+ }
+ }
}
}
The patch removed the recursive search to find it's parents and thus it was in conflict with what the function supposed to do. It works well for one level but not for multiple levels.
"My" patch was supposed to fix the unfold bug when an error line is highlighted (that is, only the block where the fold is was unfolded), and since both patches modify the same function, i'll surely get conflicts on update.
I'm working on fixing this issue. The code is ready and currently I'm testing it. Hopefully you'll get the fix in next nightly.
As a different patch was applied earlier, second part of your patch to fix this had to be reworked. I've reworked this to avoid any change in SDK.
I couldn't understand the last part (why it's needed) and thus I'm keeping it on hold.
Thanks for your hard work in providing a solution.
Regards,
Biplab