OSDN Git Service

ccrystaltextview.cpp: Fixed an issue that does not advance upward after the second...
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 13 Nov 2018 21:53:27 +0000 (06:53 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 13 Nov 2018 21:53:27 +0000 (06:53 +0900)
Externals/crystaledit/editlib/ccrystaltextview.cpp

index 08dc27f..0077dcb 100644 (file)
@@ -4997,10 +4997,12 @@ FindTextInBlock (LPCTSTR pszText, const CPoint & ptStartPosition,
                   else
                     if( ptCurrentPos.x >= nLineLength )
                       ptCurrentPos.x = nLineLength - 1;
+                  if (ptCurrentPos.x == -1)
+                    ptCurrentPos.x = 0;
 
                   LPCTSTR pszChars = GetLineChars (ptCurrentPos.y);
-                  _tcsncpy_s (line.GetBuffer(ptCurrentPos.x + 2), ptCurrentPos.x + 2, pszChars, ptCurrentPos.x + 1);
-                  line.ReleaseBuffer (ptCurrentPos.x + 1);
+                  _tcsncpy_s (line.GetBuffer(ptCurrentPos.x + 1), ptCurrentPos.x + 1, pszChars, ptCurrentPos.x);
+                  line.ReleaseBuffer (ptCurrentPos.x);
                 }
 
               ptrdiff_t nFoundPos = -1;