OSDN Git Service

PATCH: [ 1149365 ] Check linenumber to goto for upper limit
authorKimmo Varis <kimmov@gmail.com>
Wed, 23 Feb 2005 17:45:32 +0000 (17:45 +0000)
committerKimmo Varis <kimmov@gmail.com>
Wed, 23 Feb 2005 17:45:32 +0000 (17:45 +0000)
Src/MergeEditView.cpp
Src/readme.txt

index 103cb99..5f78f1f 100644 (file)
@@ -2037,11 +2037,20 @@ void CMergeEditView::OnWMGoto()
        CMergeDoc *pDoc = GetDocument();
        CPoint pos = GetCursorPos();
        int nRealLine = 0;
+       int nLastLine = 0;
 
        if (m_bIsLeft)
+       {
                nRealLine = pDoc->m_ltBuf.ComputeRealLine(pos.y);
+               int nLineCount = pDoc->m_ltBuf.GetLineCount();
+               nLastLine = pDoc->m_ltBuf.ComputeRealLine(nLineCount - 1);
+       }
        else
+       {
                nRealLine = pDoc->m_rtBuf.ComputeRealLine(pos.y);
+               int nLineCount = pDoc->m_rtBuf.GetLineCount();
+               nLastLine = pDoc->m_rtBuf.ComputeRealLine(nLineCount - 1);
+       }
 
        // Set active file and current line selected in dialog
        dlg.m_strParam.Format(_T("%d"), nRealLine + 1);
@@ -2071,6 +2080,8 @@ void CMergeEditView::OnWMGoto()
                        int nRealLine = _ttoi(dlg.m_strParam) - 1;
                        if (nRealLine < 0)
                                nRealLine = 0;
+                       if (nRealLine > nLastLine)
+                               nRealLine = nLastLine;
 
                        GotoLine(nRealLine, TRUE, dlg.m_nFile == 0);
                }
index a212449..876977f 100644 (file)
@@ -1,6 +1,8 @@
 2005-02-23 Kimmo
  PATCH: [ 1149081 ] Invalid string compare in CChildFrm.cpp
   Src: ChildFrm.cpp
+ PATCH: [ 1149365 ] Check linenumber to goto for upper limit
+  Src: MergeEditView.cpp
 
 2005-02-22 Kimmo
  PATCH: [ 1145522 ] fix crash on search