Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Reproducible Folding Bug

<< < (3/4) > >>

Biplab:
Ok, I'm posting a video showing the bug in Rev 3669 Nightly.

--- Quote ---http://www.fileden.com/files/4628/wxScintilla_CB_Rev3669.7z
--- End quote ---

See the video after the fix have been applied in Rev 3672 Nightly.

--- Quote ---http://www.fileden.com/files/4628/wxScintilla_CB_Rev3672.7z
--- End quote ---

You can easily find out the difference. :)

Regards,

Biplab

kkez:
I do see the difference. I suggest to test the patch i posted before, because i don't have that bug in rev 3669. "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.

EDIT: http://forums.codeblocks.org/index.php/topic,5360.msg41649.html#msg41649

Biplab:

--- 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. :)

I've modified DoFoldLine() SDK function.

I'm not posting the patch.

--- End quote ---
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.


--- Quote ---http://svn.berlios.de/viewcvs/codeblocks?view=rev&rev=3671
--- End quote ---

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.


--- Code: ---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);
+            }
+        }
     }
 }
--- End code ---

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.


--- Quote from: kkez on March 08, 2007, 12:36:40 pm ---"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.

--- End quote ---

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

Biplab:
Unfolding of code when an error/warning line is selected/highlighted fix is in revision 3674. :)

Regards,

Biplab

kkez:
Well,


--- Quote ---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.
...
The patch removed the recursive search to find it's parents and thus it was in conflict with what the function [was] supposed to do. It works well for one level but not for multiple levels.
--- End quote ---
Are you sure?


--- Quote ---why it's needed
--- End quote ---
I don't understand this question, don't you see the bug?

Btw, i mistyped when i explained the bug: only the block where the error line is is unfolded.


--- Quote ---Thanks for your hard work in providing a solution.
--- End quote ---
If this isn't sarcastic, i'll say that the patch is not mine (that's why i surrounded "my" with quotation marks)


--- Quote ---Unfolding of code when an error/warning line is selected/highlighted fix is in revision 3674
--- End quote ---
Thank you, i'll test it asap.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version