Notepad: Fixed "Find Up"

svn path=/trunk/; revision=18726
This commit is contained in:
Nathan Woods 2005-10-23 21:19:34 +00:00
parent fd37360789
commit 1184c4d49e

View file

@ -145,8 +145,8 @@ static BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bSho
iTargetLength = _tcslen(pFindReplace->lpstrFindWhat);
/* Retrieve the window text */
iTextLength = GetWindowTextLength(Globals.hEdit);
if (iTextLength > 0)
{
pszText = (LPTSTR) HeapAlloc(GetProcessHeap(), 0, (iTextLength + 1) * sizeof(TCHAR));
@ -166,17 +166,29 @@ static BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bSho
}
}
if (pFindReplace->Flags & FR_DOWN)
{
/* Find Down */
dwPosition = dwEnd;
while(dwPosition < iTextLength)
{
bMatches = NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwPosition);
if (bMatches)
break;
if (pFindReplace->Flags & FR_DOWN)
dwPosition++;
}
}
else
{
/* Find Up */
dwPosition = dwBegin;
while(dwPosition > 0)
{
dwPosition--;
bMatches = NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwPosition);
if (bMatches)
break;
}
}
if (bMatches)