From: Takashi Sawanaka Date: Tue, 13 Nov 2018 21:53:27 +0000 (+0900) Subject: ccrystaltextview.cpp: Fixed an issue that does not advance upward after the second... X-Git-Tag: 2.16.5~594^2~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=c5f409d08cd717a8b3ae1013fa45f8352b52a03f;p=winmerge-jp%2Fwinmerge-jp.git ccrystaltextview.cpp: Fixed an issue that does not advance upward after the second search if backward searching of one-character text only --- diff --git a/Externals/crystaledit/editlib/ccrystaltextview.cpp b/Externals/crystaledit/editlib/ccrystaltextview.cpp index 08dc27f2c..0077dcba5 100644 --- a/Externals/crystaledit/editlib/ccrystaltextview.cpp +++ b/Externals/crystaledit/editlib/ccrystaltextview.cpp @@ -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;