Commit 8c1ad98d authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Fix incorrect blame info parsing when summary has '\t'

parent 3b75f706
Pipeline #113233 passed with stage
in 3 minutes and 16 seconds
......@@ -269,6 +269,21 @@ void KateGitBlamePluginView::showCommitInfo(const QString &hash, KTextEditor::Vi
startShowProcess(view->document()->url(), hash);
}
static int nextBlockStart(const QByteArray &out, int from)
{
int next = out.indexOf('\t', from);
// tab must be the first character in line for next block
if (next > 0 && out[next - 1] != '\n') {
next++;
// move forward one line
next = out.indexOf('\n', next);
// try to look for another tab char
next = out.indexOf('\t', next);
// if not found => end
}
return next;
}
void KateGitBlamePluginView::blameFinished(int /*exitCode*/, QProcess::ExitStatus /*exitStatus*/)
{
QByteArray out = m_blameInfoProc.readAllStandardOutput();
......@@ -333,7 +348,7 @@ void KateGitBlamePluginView::blameFinished(int /*exitCode*/, QProcess::ExitStatu
m_blamedLines.back().lineText = out.mid(from, pos - from);
start = next + 1;
next = out.indexOf('\t', start);
next = nextBlockStart(out, start);
if (next == -1)
break;
next = out.indexOf('\n', next);
......@@ -387,7 +402,7 @@ void KateGitBlamePluginView::blameFinished(int /*exitCode*/, QProcess::ExitStatu
m_blamedLines.back().lineText = out.mid(from, pos - from);
start = next + 1;
next = out.indexOf('\t', start);
next = nextBlockStart(out, start);
if (next == -1)
break;
next = out.indexOf('\n', next);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment