Fix: Folded code is deleted on save

Also fixes a crash when folding code at the very end
of the document

Task-number: QTCREATORBUG-2159
This commit is contained in:
mae
2010-09-07 15:55:06 +02:00
parent 198d81735c
commit ebc305b0d8
3 changed files with 6 additions and 4 deletions

View File

@@ -527,7 +527,7 @@ void BaseTextDocumentLayout::doFoldOrUnfold(const QTextBlock& block, bool unfold
QTextBlock b = block.next();
int indent = foldingIndent(block);
while (b.isValid() && foldingIndent(b) > indent && b.next().isValid()) {
while (b.isValid() && foldingIndent(b) > indent && (unfold || b.next().isValid())) {
b.setVisible(unfold);
b.setLineCount(unfold? qMax(1, b.layout()->lineCount()) : 0);
if (unfold) { // do not unfold folded sub-blocks