riched20: Implement FR_MATCHCASE for EM_FINDTEXT.

Removed todo flag from affected FR_MATCHCASE tests.
This commit is contained in:
Lei Zhang 2006-02-21 10:19:01 -08:00 committed by Alexandre Julliard
parent 9d389ec03f
commit 805dc74809
4 changed files with 10 additions and 6 deletions

View File

@ -5,7 +5,7 @@ VPATH = @srcdir@
MODULE = riched20.dll
IMPORTLIB = libriched20.$(IMPLIBEXT)
IMPORTS = ole32 user32 gdi32 kernel32
EXTRALIBS = -luuid
EXTRALIBS = $(LIBUNICODE) -luuid
C_SRCS = \
caret.c \

View File

@ -773,8 +773,6 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, CHARRANGE *chrg, WCHAR *text, CH
TRACE("flags==0x%08lx, chrg->cpMin==%ld, chrg->cpMax==%ld text==%s\n",
flags, chrg->cpMin, chrg->cpMax, debugstr_w(text));
if (!(flags & FR_MATCHCASE))
FIXME("Case-insensitive search not implemented\n");
if (flags & ~(FR_DOWN | FR_MATCHCASE))
FIXME("Flags 0x%08lx not implemented\n", flags & ~(FR_DOWN | FR_MATCHCASE));
@ -825,7 +823,7 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, CHARRANGE *chrg, WCHAR *text, CH
int nCurStart = nStart;
int nMatched = 0;
while (pCurItem && pCurItem->member.run.strText->szData[nCurStart + nMatched] == text[nMatched])
while (pCurItem && ME_CharCompare(pCurItem->member.run.strText->szData[nCurStart + nMatched], text[nMatched], (flags & FR_MATCHCASE)))
{
nMatched++;
if (nMatched == nLen)
@ -874,7 +872,7 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, CHARRANGE *chrg, WCHAR *text, CH
int nCurEnd = nEnd;
int nMatched = 0;
while (pCurItem && pCurItem->member.run.strText->szData[nCurEnd - nMatched - 1] == text[nLen - nMatched - 1])
while (ME_CharCompare(pCurItem->member.run.strText->szData[nCurEnd - nMatched - 1], text[nLen - nMatched - 1], (flags & FR_MATCHCASE)))
{
nMatched++;
if (nMatched == nLen)

View File

@ -19,6 +19,7 @@
*/
#include "editstr.h"
#include "wine/unicode.h"
#define ALLOC_OBJ(type) HeapAlloc(me_heap, 0, sizeof(type))
#define ALLOC_N_OBJ(type, count) HeapAlloc(me_heap, 0, (count)*sizeof(type))
@ -95,6 +96,11 @@ static inline int ME_IsWSpace(WCHAR ch)
return ch > '\0' && ch <= ' ';
}
static inline int ME_CharCompare(WCHAR a, WCHAR b, int caseSensitive)
{
return caseSensitive ? (a == b) : (toupperW(a) == toupperW(b));
}
/* note: those two really return the first matching offset (starting from EOS)+1
* in other words, an offset of the first trailing white/black */
int ME_ReverseFindNonWhitespaceV(ME_String *s, int nVChar);

View File

@ -76,7 +76,7 @@ struct find_s find_tests2[] = {
{20, 10, "Wine", FR_MATCHCASE, 13, 0},
/* Case-insensitive */
{1, 31, "wInE", FR_DOWN, 4, 1},
{1, 31, "wInE", FR_DOWN, 4, 0},
{1, 31, "Wine", FR_DOWN, 4, 0},
/* High-to-low ranges */