Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Reproducible Folding Bug
Biplab:
I hope this time I'm posting the right fix. I've demonstrated in the demo movie that it works well. :)
Download the movie from:
--- Quote ---http://www.fileden.com/files/4628/wxScintillaFix.7z
--- End quote ---
Patch:
--- Code: ---Index: sdk/cbeditor.cpp
===================================================================
--- sdk/cbeditor.cpp (revision 3669)
+++ sdk/cbeditor.cpp (working copy)
@@ -1485,12 +1485,43 @@
void cbEditor::DoFoldBlockFromLine(int line, int fold)
{
m_pControl->Colourise(0, -1); // the *most* important part!
- int i = line;
+ /*int i = line;
while (i != 0)
{
if (DoFoldLine(i, fold))
return;
--i;
+ }*/
+ int i, level;
+ int maxLine = m_pControl->GetLastChild(line, -1);
+ bool expand = (fold == 0 ? true : false);
+ bool IsCurLineFolded; /* Is current line folded? */
+
+ if (maxLine >= line)
+ {
+ /* The following code may be replaced with DoFoldLine(line, fold)
+ * call. But I found that doesn't solve Unfold Current Block problem.
+ * In my opnion, ShowLines(lineFrom, lineTo) and
+ * HideLines(lineFrom, lineTo) calls are not working properly.
+ *
+ * Need More detailed investigation - [Biplab]
+ */
+ for (i = line; i <= maxLine; ++i)
+ {
+ level = m_pControl->GetFoldLevel(i);
+ IsCurLineFolded = m_pControl->GetFoldExpanded(i);
+ if (level & wxSCI_FOLDLEVELHEADERFLAG)
+ {
+ if (fold == 2) // We want to toggle current block.
+ m_pControl->ToggleFold(i); //But strangely it doesn't toggle root
+ /* fold = 0 (Unfold), 1 (fold), 2 (toggle)
+ * So check if fold = 0 then GetFoldExpanded(line) = false
+ * before toggling it and vice-versa
+ */
+ else if ((!IsCurLineFolded && expand) || (IsCurLineFolded && !expand))
+ m_pControl->ToggleFold(i);
+ }
+ }
}
}
--- End code ---
Known Issue:
This patch fails to solve One Issue. If Toggle current block is selected, it fails to toggle the root, from where it's called, if any child is in folded state inside. Though it changes the fold state of all childs successfully.
Regards,
Biplab
Biplab:
@Morten
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.
Regards,
Biplab
MortenMacFly:
--- Quote from: Biplab on March 07, 2007, 03:30:53 pm ---Bug fixed finally. Known issue reported in last reply has also been fixed. Committed in revision 3671. :)
--- End quote ---
Nice one!!! :D I'm currently compiling C::B to give it a try. GREAT work though!
With regards, Morten.
Biplab:
But this changes have made a minor change in SDK. It fails in cases where child is inside a parent and folded. Will try to update it.
kkez:
--- Quote from: MortenMacFly on March 07, 2007, 09:55:30 am ---
--- Quote from: kkez on March 07, 2007, 08:55:06 am ---I can't reproduce at all...
--- End quote ---
What does that mean? They are not reproducible on the SVN version for you or at the SVN+BerliOS patch #1740 version your are using?
--- End quote ---
I don't see another meaning:
http://savefile.com/files/536851
On "rev 3669 - gcc 3.4.5 Windows/unicode"
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version