Editor: Allow negative folding indent.

Fixing folding issues in the c++ editor if too many closing folding
regions were found.

Change-Id: I5c3476a6922af07be9b49d396b684a5f3b5a5e33
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
David Schulz
2015-05-20 08:38:52 +02:00
parent 4763acbd95
commit a6e1c3cb54
2 changed files with 9 additions and 9 deletions

View File

@@ -498,7 +498,7 @@ void TextDocumentLayout::setFoldingIndent(const QTextBlock &block, int indent)
if (TextBlockUserData *userData = testUserData(block)) if (TextBlockUserData *userData = testUserData(block))
userData->setFoldingIndent(0); userData->setFoldingIndent(0);
} else { } else {
userData(block)->setFoldingIndent(qMax(0,indent)); userData(block)->setFoldingIndent(indent);
} }
} }

View File

@@ -66,13 +66,13 @@ class TEXTEDITOR_EXPORT TextBlockUserData : public QTextBlockUserData
public: public:
inline TextBlockUserData() inline TextBlockUserData()
: m_folded(false), : m_foldingIndent(0)
m_ifdefedOut(false), , m_folded(false)
m_foldingIndent(0), , m_ifdefedOut(false)
m_lexerState(0), , m_lexerState(0)
m_foldingStartIncluded(false), , m_foldingStartIncluded(false)
m_foldingEndIncluded(false), , m_foldingEndIncluded(false)
m_codeFormatterData(0) , m_codeFormatterData(0)
{} {}
~TextBlockUserData(); ~TextBlockUserData();
@@ -138,9 +138,9 @@ public:
private: private:
TextMarks m_marks; TextMarks m_marks;
int m_foldingIndent : 16;
uint m_folded : 1; uint m_folded : 1;
uint m_ifdefedOut : 1; uint m_ifdefedOut : 1;
uint m_foldingIndent : 16;
uint m_lexerState : 8; uint m_lexerState : 8;
uint m_foldingStartIncluded : 1; uint m_foldingStartIncluded : 1;
uint m_foldingEndIncluded : 1; uint m_foldingEndIncluded : 1;