forked from qt-creator/qt-creator
Git: Restart instant blame on document save
When the current line is modified, refresh the blame after saving. Before, the cursor had to be moved to another line to restart the blame. Change-Id: I61012f1c8583545b9bc34a71ff63ade2f9cc5b13 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
5d5a36ef18
commit
af5a8fe80c
@@ -437,6 +437,7 @@ public:
|
||||
QTimer *m_cursorPositionChangedTimer = nullptr;
|
||||
std::unique_ptr<BlameMark> m_blameMark;
|
||||
QMetaObject::Connection m_blameCursorPosConn;
|
||||
QMetaObject::Connection m_documentChangedConn;
|
||||
|
||||
GitGrep gitGrep{&m_gitClient};
|
||||
|
||||
@@ -1462,6 +1463,11 @@ void GitPluginPrivate::setupInstantBlame()
|
||||
}
|
||||
m_cursorPositionChangedTimer->start(500);
|
||||
});
|
||||
IDocument *document = editor->document();
|
||||
m_documentChangedConn = connect(document, &IDocument::changed, this, [this, document] {
|
||||
if (!document->isModified())
|
||||
forceInstantBlame();
|
||||
});
|
||||
|
||||
forceInstantBlame();
|
||||
};
|
||||
@@ -1590,6 +1596,7 @@ void GitPluginPrivate::stopInstantBlame()
|
||||
m_blameMark.reset();
|
||||
m_cursorPositionChangedTimer->stop();
|
||||
disconnect(m_blameCursorPosConn);
|
||||
disconnect(m_documentChangedConn);
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::refreshWorkingDirectory(const FilePath &workingDirectory)
|
||||
|
Reference in New Issue
Block a user