forked from qt-creator/qt-creator
TextEditor: Add some logging for code folding
Change-Id: I95f6c1b370d458602d9d97e36b21d61c1d261e59 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "tabsettings.h"
|
||||
#include "textdocumentlayout.h"
|
||||
#include "texteditor.h"
|
||||
#include "texteditorconstants.h"
|
||||
#include "texteditorsettings.h"
|
||||
#include "texteditortr.h"
|
||||
#include "textindenter.h"
|
||||
@@ -573,6 +574,9 @@ void TextDocument::setIfdefedOutBlocks(const QList<BlockRange> &blocks)
|
||||
}
|
||||
|
||||
if (braceDepthDelta) {
|
||||
qCDebug(Internal::foldingLog)
|
||||
<< "changing brace depth and folding indent by" << braceDepthDelta << "for line"
|
||||
<< (block.blockNumber() + 1) << "due to ifdefed out code";
|
||||
TextDocumentLayout::changeBraceDepth(block,braceDepthDelta);
|
||||
TextDocumentLayout::changeFoldingIndent(block, braceDepthDelta); // ### C++ only, refactor!
|
||||
}
|
||||
|
||||
@@ -6339,6 +6339,13 @@ void TextEditorWidgetPrivate::paintCodeFolding(QPainter &painter,
|
||||
bool drawBox = nextBlockUserData
|
||||
&& TextDocumentLayout::foldingIndent(data.block)
|
||||
< nextBlockUserData->foldingIndent();
|
||||
if (drawBox) {
|
||||
qCDebug(foldingLog) << "need to paint folding marker";
|
||||
qCDebug(foldingLog) << "folding indent for line" << (data.block.blockNumber() + 1) << "is"
|
||||
<< TextDocumentLayout::foldingIndent(data.block);
|
||||
qCDebug(foldingLog) << "folding indent for line" << (nextBlock.blockNumber() + 1) << "is"
|
||||
<< nextBlockUserData->foldingIndent();
|
||||
}
|
||||
|
||||
const int blockNumber = data.block.blockNumber();
|
||||
bool active = blockNumber == extraAreaHighlightFoldBlockNumber;
|
||||
|
||||
@@ -125,4 +125,9 @@ TextStyle styleFromName(const char *name)
|
||||
}
|
||||
|
||||
} // namespace Constants
|
||||
|
||||
namespace Internal {
|
||||
Q_LOGGING_CATEGORY(foldingLog, "qtc.editor.folding", QtWarningMsg)
|
||||
} // namespace Internal
|
||||
|
||||
} // namespace TextEditor
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "texteditor_global.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
namespace TextEditor {
|
||||
|
||||
@@ -250,4 +250,7 @@ const char BOOKMARKS_NEXT_ACTION[] = "Bookmarks.Next";
|
||||
const unsigned COMPLETION_ASSIST_TOOLTIP_DELAY = 100;
|
||||
|
||||
} // namespace Constants
|
||||
|
||||
namespace Internal { Q_DECLARE_LOGGING_CATEGORY(foldingLog) }
|
||||
|
||||
} // namespace TextEditor
|
||||
|
||||
Reference in New Issue
Block a user