forked from qt-creator/qt-creator
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:
@@ -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)) {
|
||||||
|
Reference in New Issue
Block a user