From 5cd81bfac5f812d642a002ed28956fde768a2efb Mon Sep 17 00:00:00 2001 From: Takashi Sawanaka Date: Sat, 22 Apr 2023 21:31:22 +0900 Subject: [PATCH] Fix problem of not moving to conflicted line after auto-merge --- Src/MergeDoc.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Src/MergeDoc.cpp b/Src/MergeDoc.cpp index c0fdf5d2d5b..e42b7aac691 100644 --- a/Src/MergeDoc.cpp +++ b/Src/MergeDoc.cpp @@ -3339,15 +3339,24 @@ void CMergeDoc::MoveOnLoad(int nPane, int nLineIndex, bool bRealLine, int nCharI } if (nLineIndex == -1) { - // scroll to first diff - if (GetOptionsMgr()->GetBool(OPT_SCROLL_TO_FIRST) && - m_diffList.HasSignificantDiffs()) + if (this->GetCurrentDiff() != -1) { - int nDiff = m_diffList.FirstSignificantDiff(); - if (nDiff != -1) - m_pView[0][nPane]->SelectDiff(nDiff, true, false); - m_pView[0][nPane]->SetActivePane(); - return; + DIFFRANGE di; + m_diffList.GetDiff(this->GetCurrentDiff(), di); + nLineIndex = bRealLine ? di.begin[nPane] : di.dbegin; + } + else + { + // scroll to first diff + if (GetOptionsMgr()->GetBool(OPT_SCROLL_TO_FIRST) && + m_diffList.HasSignificantDiffs()) + { + int nDiff = m_diffList.FirstSignificantDiff(); + if (nDiff != -1) + m_pView[0][nPane]->SelectDiff(nDiff, true, false); + m_pView[0][nPane]->SetActivePane(); + return; + } } } m_pView[0][nPane]->GotoLine(nLineIndex < 0 ? 0 : nLineIndex, bRealLine, nPane, true, nCharIndex);