Lei Zhang : riched20: Implement FR_MATCHCASE for EM_FINDTEXT.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Feb 22 05:43:57 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 805dc748097d0a7a79fdd31d46e3cd10296ee612
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=805dc748097d0a7a79fdd31d46e3cd10296ee612
Author: Lei Zhang <leiz at ucla.edu>
Date: Tue Feb 21 10:19:01 2006 -0800
riched20: Implement FR_MATCHCASE for EM_FINDTEXT.
Removed todo flag from affected FR_MATCHCASE tests.
---
dlls/riched20/Makefile.in | 2 +-
dlls/riched20/editor.c | 6 ++----
dlls/riched20/editor.h | 6 ++++++
dlls/riched20/tests/editor.c | 2 +-
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/riched20/Makefile.in b/dlls/riched20/Makefile.in
index bb646c8..38df23c 100644
--- a/dlls/riched20/Makefile.in
+++ b/dlls/riched20/Makefile.in
@@ -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 \
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index e7b7fec..496210e 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -773,8 +773,6 @@ ME_FindText(ME_TextEditor *editor, DWORD
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
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
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)
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index ec8bd5b..8d39f9b 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -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);
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 874aee9..b650785 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -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 */
More information about the wine-cvs
mailing list