From c58f0877fe76eed761ba767c95baf68170fbe7c4 Mon Sep 17 00:00:00 2001 From: sdottaka Date: Thu, 23 Jan 2014 23:10:53 +0900 Subject: [PATCH] 3way-diff: Don't highlight the word diff in right pane for visibility if the word diff is OP_1STONLY(center==right) , and don't highlight the word diff in left pane if the word diff is OP_3RDONLY(left==center) for --HG-- branch : stable --- Src/MergeDoc.h | 5 ++++- Src/MergeDocLineDiffs.cpp | 1 + Src/MergeEditView.cpp | 7 +++++++ Src/stringdiffs.h | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Src/MergeDoc.h b/Src/MergeDoc.h index 144e074cc..de2ecab31 100644 --- a/Src/MergeDoc.h +++ b/Src/MergeDoc.h @@ -115,7 +115,9 @@ struct WordDiff { int end[3]; // 0-based, eg, end[1] is from str2 int beginline[3]; int endline[3]; - WordDiff(int s1=0, int e1=0, int bl1=0, int el1=0, int s2=0, int e2=0, int bl2=0, int el2=0, int s3=0, int e3=0, int bl3=0, int el3=0) + int op; + WordDiff(int s1=0, int e1=0, int bl1=0, int el1=0, int s2=0, int e2=0, int bl2=0, int el2=0, int s3=0, int e3=0, int bl3=0, int el3=0, int op=0) + : op(op) { if (s1>e1) e1=s1; if (s2>e2) e2=s2; @@ -142,6 +144,7 @@ struct WordDiff { beginline[i] = src.beginline[i]; endline[i] = src.endline[i]; } + op = src.op; } }; diff --git a/Src/MergeDocLineDiffs.cpp b/Src/MergeDocLineDiffs.cpp index 4c3674126..e4ff8456a 100644 --- a/Src/MergeDocLineDiffs.cpp +++ b/Src/MergeDocLineDiffs.cpp @@ -249,6 +249,7 @@ void CMergeDoc::GetWordDiffArray(int nLineIndex, vector *pWordDiffs) if (m_ptBuf[file]->GetLineLength(nLine) < wd.end[file]) wd.end[file] = m_ptBuf[file]->GetLineLength(nLine); } + wd.op = it->op; pWordDiffs->push_back(wd); } diff --git a/Src/MergeEditView.cpp b/Src/MergeEditView.cpp index b9bb06e38..0a81384c9 100644 --- a/Src/MergeEditView.cpp +++ b/Src/MergeEditView.cpp @@ -424,6 +424,13 @@ int CMergeEditView::GetAdditionalTextBlocks (int nLineIndex, TEXTBLOCK *&pBuf) { if (worddiffs[i].beginline[m_nThisPane] > nLineIndex || worddiffs[i].endline[m_nThisPane] < nLineIndex ) continue; + if (pDoc->m_nBuffers > 2) + { + if (m_nThisPane == 0 && worddiffs[i].op == OP_3RDONLY) + continue; + else if (m_nThisPane == 2 && worddiffs[i].op == OP_1STONLY) + continue; + } int begin[3], end[3]; bool deleted = false; for (int pane = 0; pane < pDoc->m_nBuffers; pane++) diff --git a/Src/stringdiffs.h b/Src/stringdiffs.h index 9eb32a7ee..96abb032b 100644 --- a/Src/stringdiffs.h +++ b/Src/stringdiffs.h @@ -38,6 +38,7 @@ struct wdiff { begin[i] = src.begin[i]; end[i] = src.end[i]; } + op = src.op; } }; -- 2.11.0