Commit 9b405512 authored by mae's avatar mae
Browse files

Fix code folding issue with empty nested blocks like in:

void main()
{
{
}
int i;
}
parent 78d07c6d
......@@ -2833,7 +2833,7 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
document()->findBlockByNumber(d->m_highlightBlocksInfo.open.last()).position()
);
QTextBlock c = cursor.block();
if (!TextBlockUserData::canCollapse(c))
if (TextBlockUserData::hasCollapseAfter(c.previous()))
c = c.previous();
toggleBlockVisible(c);
d->moveCursorVisible(false);
......
......@@ -145,13 +145,10 @@ public:
inline static bool hasCollapseAfter(const QTextBlock & block)
{
if (!block.isValid())
return false;
TextBlockUserData *data = static_cast<TextBlockUserData*>(block.userData());
if (data && data->collapseMode() != NoCollapse) {
if (!block.isValid()) {
return false;
} else if (block.next().isValid()) {
data = static_cast<TextBlockUserData*>(block.next().userData());
TextBlockUserData *data = static_cast<TextBlockUserData*>(block.next().userData());
if (data && data->collapseMode() == TextBlockUserData::CollapseThis && !data->m_ifdefedOut)
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment