OSDN Git Service

modify the assert in GetText/GetTextWithoutEmptys
authorLaurent Ganier <laoran@users.sourceforge.net>
Thu, 13 Nov 2003 13:31:08 +0000 (13:31 +0000)
committerLaurent Ganier <laoran@users.sourceforge.net>
Thu, 13 Nov 2003 13:31:08 +0000 (13:31 +0000)
Src/GhostTextBuffer.cpp
Src/editlib/ccrystaltextbuffer.cpp
Src/readme.txt

index af2fd88..b6a4ad5 100644 (file)
@@ -161,8 +161,10 @@ void CGhostTextBuffer::GetTextWithoutEmptys(int nStartLine, int nStartChar,
        ASSERT(nStartChar >= 0 && nStartChar <= GetLineLength(nStartLine));
        ASSERT(nEndLine >= 0 && nEndLine < lines);
        ASSERT(nEndChar >= 0 && nEndChar <= GetFullLineLength(nEndLine));
-       ASSERT(nStartLine < nEndLine || nStartLine == nEndLine && 
-               nStartChar < nEndChar);
+       ASSERT(nStartLine < nEndLine || nStartLine == nEndLine && nStartChar <= nEndChar);
+       // some edit functions (copy...) should do nothing when there is no selection.
+       // assert to be sure to catch these 'do nothing' cases.
+       ASSERT(nStartLine != nEndLine || nStartChar != nEndChar);
 
        // estimate size (upper bound)
        int nBufSize = 0;
index 0f76d6f..d84d4c8 100644 (file)
@@ -945,7 +945,10 @@ GetText (int nStartLine, int nStartChar, int nEndLine, int nEndChar, CString & t
   ASSERT (nStartChar >= 0 && nStartChar <= m_aLines[nStartLine].m_nLength);
   ASSERT (nEndLine >= 0 && nEndLine < m_aLines.GetSize ());
   ASSERT (nEndChar >= 0 && nEndChar <= m_aLines[nEndLine].m_nLength);
-  ASSERT (nStartLine < nEndLine || nStartLine == nEndLine && nStartChar < nEndChar);
+  ASSERT (nStartLine < nEndLine || nStartLine == nEndLine && nStartChar <= nEndChar);
+  // some edit functions (copy...) should do nothing when there is no selection.
+  // assert to be sure to catch these 'do nothing' cases.
+  ASSERT (nStartLine != nEndLine || nStartChar != nEndChar);
 
   if (pszCRLF == NULL)
     pszCRLF = crlf;
@@ -1058,7 +1061,10 @@ InternalDeleteText (CCrystalTextView * pSource, int nStartLine, int nStartChar,
   ASSERT (nStartChar >= 0 && nStartChar <= m_aLines[nStartLine].m_nLength);
   ASSERT (nEndLine >= 0 && nEndLine < m_aLines.GetSize ());
   ASSERT (nEndChar >= 0 && nEndChar <= m_aLines[nEndLine].m_nLength);
-  ASSERT (nStartLine < nEndLine || nStartLine == nEndLine && nStartChar < nEndChar);
+  ASSERT (nStartLine < nEndLine || nStartLine == nEndLine && nStartChar <= nEndChar);
+  // some edit functions (delete...) should do nothing when there is no selection.
+  // assert to be sure to catch these 'do nothing' cases.
+  ASSERT (nStartLine != nEndLine || nStartChar != nEndChar);
   if (m_bReadOnly)
     return FALSE;
 
index d9dff60..d3db6aa 100644 (file)
@@ -5,6 +5,10 @@
   WinMerge: MainFrm.cpp
 
 2003-11-13 Laoran
+ modify the assert in GetText/GetTextWithoutEmptys
+ submitted by Jochen
+  WinMerge: GhostTextBuffer.cpp
+  editlib: ccrystaltextbuffer.cpp
  Merging lwdisp.c with Jochen's changes (see patch #837480)
   common: lwdisp.c lwdisp.h
  PATCH: [ 838354 ] Revisit Speedup Speed up display of large differences