Git: Provide a real highlighter for interactive rebase

* Kate highlighter doesn't have enough colors
* It works out of the box only on Windows
* New editor support links

Change-Id: I09bbaef08574660e535ccb86c2c460d5976fc2e3
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-06-02 23:05:51 +03:00
committed by Orgad Shaneh
parent 3e022beb12
commit 3f1901cb1f
7 changed files with 107 additions and 68 deletions

View File

@@ -232,14 +232,19 @@ void GitEditor::revertChange()
void GitEditor::init()
{
VcsBase::VcsBaseEditorWidget::init();
if (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
Core::Id editorId = editor()->id();
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
new GitSubmitHighlighter(baseTextDocument().data());
else if (editorId == Git::Constants::GIT_REBASE_EDITOR_ID)
new GitRebaseHighlighter(baseTextDocument().data());
}
bool GitEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
bool res = VcsBaseEditorWidget::open(errorString, fileName, realFileName);
if (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID) {
Core::Id editorId = editor()->id();
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID
|| editorId == Git::Constants::GIT_REBASE_EDITOR_ID) {
QFileInfo fi(fileName);
setSource(GitPlugin::instance()->gitClient()->findRepositoryForGitDir(fi.absolutePath()));
}
@@ -298,7 +303,8 @@ QString GitEditor::revisionSubject(const QTextBlock &inBlock) const
bool GitEditor::supportChangeLinks() const
{
return VcsBaseEditorWidget::supportChangeLinks()
|| (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID);
|| (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
|| (editor()->id() == Git::Constants::GIT_REBASE_EDITOR_ID);
}
} // namespace Internal