OSDN Git Service

Fix that 'Match whole word only' in Replace dialog didn't work properly
authorsdottaka <sdottaka@users.sourceforge.net>
Sat, 27 Dec 2014 11:48:53 +0000 (20:48 +0900)
committersdottaka <sdottaka@users.sourceforge.net>
Sat, 27 Dec 2014 11:48:53 +0000 (20:48 +0900)
e.g.
  Find what: L
  Replace with: R
  Match whole word only: checked

  NULL -> NULR

--HG--
branch : stable

Externals/crystaledit/editlib/ccrystaltextview.cpp

index 5b17a38..f393747 100644 (file)
@@ -4805,6 +4805,7 @@ FindStringHelper (LPCTSTR pszFindWhere, LPCTSTR pszFindWhat, DWORD dwFlags, int
       ASSERT (pszFindWhat != NULL);
       int nCur = 0;
       int nLength = (int) _tcslen (pszFindWhat);
+      LPCTSTR pszFindWhereOrig = pszFindWhere;
       nLen = nLength;
       for (;;)
         {
@@ -4813,7 +4814,7 @@ FindStringHelper (LPCTSTR pszFindWhere, LPCTSTR pszFindWhat, DWORD dwFlags, int
             return -1;
           if ((dwFlags & FIND_WHOLE_WORD) == 0)
             return nCur + (int) (pszPos - pszFindWhere);
-          if (pszPos > pszFindWhere && xisalnum (pszPos[-1]))
+          if (pszPos > pszFindWhereOrig && xisalnum (pszPos[-1]))
             {
               nCur += (int) (pszPos - pszFindWhere + 1);
               pszFindWhere = pszPos + 1;