OSDN Git Service

2005-03-06 Perry
authorPerry Rapp <elsapo@users.sourceforge.net>
Sun, 6 Mar 2005 02:52:11 +0000 (02:52 +0000)
committerPerry Rapp <elsapo@users.sourceforge.net>
Sun, 6 Mar 2005 02:52:11 +0000 (02:52 +0000)
 PATCH: [ 1157524 ] Fix view line length
  editlib: ccrystaltextview.cpp ccrystaltextview.h

Src/editlib/ccrystaltextview.cpp
Src/editlib/ccrystaltextview.h
Src/readme.txt

index 880fe08..8081ac2 100644 (file)
@@ -1264,7 +1264,7 @@ void CCrystalTextView::DrawScreenLine( CDC *pdc, CPoint &ptOrigin, const CRect &
 {
   CPoint       originalOrigin = ptOrigin;
   CRect                frect = rcClip;
-  const int nLineLength = GetLineLength( ptTextPos.y );
+  const int nLineLength = GetViewableLineLength( ptTextPos.y );
   const int nLineHeight = GetLineHeight();
 
   frect.top = ptOrigin.y;
@@ -1427,12 +1427,8 @@ DrawSingleLine (CDC * pdc, const CRect & rc, int nLineIndex)
   COLORREF crBkgnd, crText;
   GetLineColors (nLineIndex, crBkgnd, crText, bDrawWhitespace);
 
-  int nLength = GetLineLength (nLineIndex);
+  int nLength = GetViewableLineLength (nLineIndex);
   LPCTSTR pszChars = GetLineChars (nLineIndex);
-  if (m_bViewEols)
-    { // Display EOL (end of line) characters too
-      nLength = GetFullLineLength(nLineIndex);
-    }
 
   //  Parse the line
   DWORD dwCookie = GetParseCookie (nLineIndex - 1);
@@ -2697,6 +2693,16 @@ GetFullLineLength (int nLineIndex) const
   return m_pTextBuffer->GetFullLineLength (nLineIndex);
 }
 
+// How many bytes of line are displayed on-screen?
+int CCrystalTextView::
+GetViewableLineLength (int nLineIndex) const
+{
+       if (m_bViewEols)
+               return GetFullLineLength(nLineIndex);
+       else
+               return GetLineLength(nLineIndex);
+}
+
 LPCTSTR CCrystalTextView::
 GetLineChars (int nLineIndex) const
 {
@@ -3330,7 +3336,7 @@ AssertValidTextPos (const CPoint & point)
     {
       ASSERT (m_nTopLine >= 0 && m_nOffsetChar >= 0);
       ASSERT (point.y >= 0 && point.y < GetLineCount ());
-      ASSERT (point.x >= 0 && point.x <= GetLineLength (point.y));
+      ASSERT (point.x >= 0 && point.x <= GetViewableLineLength (point.y));
     }
 }
 #endif
index a1cf3d0..f50fd0a 100644 (file)
@@ -408,6 +408,7 @@ protected :
 public:
     virtual int GetLineLength (int nLineIndex) const;
     virtual int GetFullLineLength (int nLineIndex) const;
+       virtual int GetViewableLineLength(int nLineIndex) const;
     virtual int GetLineActualLength (int nLineIndex);
     virtual LPCTSTR GetLineChars (int nLineIndex) const;
 protected:
index 91d9461..bbe1e10 100644 (file)
@@ -1,3 +1,7 @@
+2005-03-06 Perry
+ PATCH: [ 1157524 ] Fix view line length
+  editlib: ccrystaltextview.cpp ccrystaltextview.h
+
 2005-03-05 Perry
  Rename CDirFrame::SetFilter to CDirFrame::SetFilterStatusDisplay for easier greps.
   Src: DirDoc.cpp DirFrame.cpp DirFrame.h