OSDN Git Service

[ 769122 ] Keep top screen line within the shorter panel
authorLaurent Ganier <laoran@users.sourceforge.net>
Fri, 11 Jul 2003 22:54:17 +0000 (22:54 +0000)
committerLaurent Ganier <laoran@users.sourceforge.net>
Fri, 11 Jul 2003 22:54:17 +0000 (22:54 +0000)
Src/MergeEditView.cpp
Src/readme.txt

index c9742b4..af78072 100644 (file)
@@ -228,12 +228,27 @@ void CMergeEditView::UpdateSiblingScrollPos (BOOL bHorz)
                ASSERT (nCurrentRow >= 0 && nCurrentRow < pSplitterWnd->GetRowCount ());
                ASSERT (nCurrentCol >= 0 && nCurrentCol < pSplitterWnd->GetColumnCount ());
 
+               // limit the TopLine : must be smaller than GetLineCount for all the panels
+               int newTopLine = m_nTopLine;
                int nRows = pSplitterWnd->GetRowCount ();
                int nCols = pSplitterWnd->GetColumnCount ();
                for (int nRow = 0; nRow < nRows; nRow++)
                {
                        for (int nCol = 0; nCol < nCols; nCol++)
                        {
+                               CMergeEditView *pSiblingView = static_cast<CMergeEditView*>(GetSiblingView (nRow, nCol));
+                               if (pSiblingView != NULL)
+                                       if (pSiblingView->GetLineCount() <= newTopLine)
+                                               newTopLine = pSiblingView->GetLineCount()-1;
+                       }
+               }
+               if (m_nTopLine != newTopLine) 
+                       ScrollToLine(newTopLine);
+
+               for (nRow = 0; nRow < nRows; nRow++)
+               {
+                       for (int nCol = 0; nCol < nCols; nCol++)
+                       {
                                if (!(nRow == nCurrentRow && nCol == nCurrentCol))  //  We don't need to update ourselves
                                {
                                        CMergeEditView *pSiblingView = static_cast<CMergeEditView*>(GetSiblingView (nRow, nCol));
index 16da545..729a437 100644 (file)
@@ -1,3 +1,7 @@
+2003-07-12 Laoran
+ PATCH: [ 769122 ] Keep top screen line within the shorter panel
+  WinMerge: MergeEditView.cpp 
+
 2003-07-11 Perry
  PATCH: [ 765150 ] Fix char count in edit view bottom status line
   WinMerge: ChildFrm.cpp ChildFrm.h Merge.rc MergeEditStatus.h