VCS: Do not offer to revert a chunk when in a diff header

Do not offer to revert a chunk when in a diff header
This commit is contained in:
Tobias Hunger
2011-04-08 10:42:07 +02:00
parent a809a0d2a6
commit a6ec8e29ea

View File

@@ -755,6 +755,11 @@ DiffChunk VCSBaseEditorWidget::diffChunk(QTextCursor cursor) const
DiffChunk rc; DiffChunk rc;
// Search back for start of chunk. // Search back for start of chunk.
QTextBlock block = cursor.block(); QTextBlock block = cursor.block();
QTextBlock next = block.next();
if (next.isValid() && TextEditor::BaseTextDocumentLayout::foldingIndent(next) <= 1)
/* We are in a diff header, not in a chunk! DiffHighlighter sets the foldingIndent for us. */
return rc;
int chunkStart = 0; int chunkStart = 0;
for ( ; block.isValid() ; block = block.previous()) { for ( ; block.isValid() ; block = block.previous()) {
if (checkChunkLine(block.text(), &chunkStart)) { if (checkChunkLine(block.text(), &chunkStart)) {