OSDN Git Service

PATCH: [ 874451 ] Update lineposition offpane when navigating diffs
authorKimmo Varis <kimmov@gmail.com>
Mon, 12 Jan 2004 05:48:20 +0000 (05:48 +0000)
committerKimmo Varis <kimmov@gmail.com>
Mon, 12 Jan 2004 05:48:20 +0000 (05:48 +0000)
Src/MergeEditView.cpp
Src/readme.txt

index af4bc70..45c97e0 100644 (file)
@@ -1129,7 +1129,21 @@ void CMergeEditView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
 void CMergeEditView::ShowDiff(BOOL bScroll, BOOL bSelectText)
 {
        CMergeDoc *pd = GetDocument();
+       CMergeEditView *pCurrentView = NULL;
+       CMergeEditView *pOtherView = NULL;
        int nDiff = pd->GetCurrentDiff();
+
+       if (m_bIsLeft)
+       {
+               pCurrentView = pd->GetLeftView();
+               pOtherView = pd->GetRightView();
+       }
+       else
+       {
+               pCurrentView = pd->GetRightView();
+               pOtherView = pd->GetLeftView();
+       }
+
        if (nDiff >= 0 && nDiff < (int)pd->m_nDiffs)
        {
                CPoint ptStart, ptEnd;
@@ -1149,10 +1163,14 @@ void CMergeEditView::ShowDiff(BOOL bScroll, BOOL bSelectText)
                                int line = ptStart.y - CONTEXT_LINES_ABOVE;
                                if (line < 0)
                                        line = 0;
-                               ScrollToLine(line);
+
+                               pCurrentView->ScrollToLine(line);
+                               pOtherView->ScrollToLine(line);
                        }
-                       SetCursorPos(ptStart);
-                       SetAnchor(ptStart);
+                       pCurrentView->SetCursorPos(ptStart);
+                       pOtherView->SetCursorPos(ptStart);
+                       pCurrentView->SetAnchor(ptStart);
+                       pOtherView->SetAnchor(ptStart);
                }
 
                if (bSelectText)
index 2c77100..eb000a2 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-12 Kimmo
+ PATCH: [ 874451 ] Update lineposition offpane when navigating diffs
+ Fixes wrong linenumber and cursor position in inactive file
+  WinMerge: MergeEditView.cpp
+
 2004-01-11 Perry
  PATCH: [ 875237 ] Fix fwrite call in UniStdioFile::WriteString
  Fix byte count and argument order when UniStdioFile::WriteString calls fwrite.