I write in this topic http://forums.codeblocks.org/index.php?topic=1858 (http://forums.codeblocks.org/index.php?topic=1858) about folding bug, but I find two new bugs.
This code fixed all known folding bugs:
void Code_Editor::OnKeyPressed(wxKeyEvent& event) // Change it for Code::Blocks code editor
{
long KeyCode = event.GetKeyCode();
// Fix 'Delete key' folding bug
if (KeyCode == WXK_DELETE)
{
int current_line = GetCurrentLine();
if (!GetFoldExpanded(current_line))
{
ToggleFold(current_line);
}
}
// Fix 'Return key' folding bug
if (KeyCode == WXK_RETURN)
{
int current_line = GetCurrentLine();
if (!GetFoldExpanded(current_line))
{
if (GetColumn(GetCurrentPos()) != 0)
{
ToggleFold(current_line);
}
}
}
// Fix 'Backspace key' folding bug
if (KeyCode == WXK_BACK)
{
if (GetColumn(GetCurrentPos()) == 0)
{
int back_line = GetCurrentLine() - 1;
if (!GetLineVisible(back_line))
{
ToggleFold(back_line);
}
}
}
event.Skip();
}
Thank you.