Commit ab81945d authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/listview: Use case-insensitive compare in LVM_FINDITEM.

parent f6802b7a
EXTRADEFS = -D_COMCTL32_ EXTRADEFS = -D_COMCTL32_
MODULE = comctl32.dll MODULE = comctl32.dll
IMPORTLIB = comctl32 IMPORTLIB = comctl32
IMPORTS = uuid user32 gdi32 advapi32 usp10 imm32 IMPORTS = uuid user32 gdi32 advapi32 usp10 imm32 kernelbase
DELAYIMPORTS = winmm uxtheme DELAYIMPORTS = winmm uxtheme
EXTRADLLFLAGS = -mno-cygwin EXTRADLLFLAGS = -mno-cygwin
......
...@@ -140,6 +140,7 @@ ...@@ -140,6 +140,7 @@
#include "commctrl.h" #include "commctrl.h"
#include "comctl32.h" #include "comctl32.h"
#include "uxtheme.h" #include "uxtheme.h"
#include "shlwapi.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -6313,6 +6314,7 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart, ...@@ -6313,6 +6314,7 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart,
INT nItem = nStart + 1, nLast = infoPtr->nItemCount, nNearestItem = -1; INT nItem = nStart + 1, nLast = infoPtr->nItemCount, nNearestItem = -1;
ULONG xdist, ydist, dist, mindist = 0x7fffffff; ULONG xdist, ydist, dist, mindist = 0x7fffffff;
POINT Position, Destination; POINT Position, Destination;
int search_len = 0;
LVITEMW lvItem; LVITEMW lvItem;
/* Search in virtual listviews should be done by application, not by /* Search in virtual listviews should be done by application, not by
...@@ -6378,6 +6380,9 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart, ...@@ -6378,6 +6380,9 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart,
nItem = bNearest ? -1 : nStart + 1; nItem = bNearest ? -1 : nStart + 1;
if (lpFindInfo->flags & (LVFI_PARTIAL | LVFI_SUBSTRING))
search_len = lstrlenW(lpFindInfo->psz);
again: again:
for (; nItem < nLast; nItem++) for (; nItem < nLast; nItem++)
{ {
...@@ -6398,12 +6403,11 @@ again: ...@@ -6398,12 +6403,11 @@ again:
{ {
if (lpFindInfo->flags & (LVFI_PARTIAL | LVFI_SUBSTRING)) if (lpFindInfo->flags & (LVFI_PARTIAL | LVFI_SUBSTRING))
{ {
WCHAR *p = wcsstr(lvItem.pszText, lpFindInfo->psz); if (StrCmpNIW(lvItem.pszText, lpFindInfo->psz, search_len)) continue;
if (!p || p != lvItem.pszText) continue;
} }
else else
{ {
if (lstrcmpW(lvItem.pszText, lpFindInfo->psz) != 0) continue; if (StrCmpIW(lvItem.pszText, lpFindInfo->psz)) continue;
} }
} }
......
...@@ -5366,6 +5366,19 @@ static void test_finditem(void) ...@@ -5366,6 +5366,19 @@ static void test_finditem(void)
r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
expect(0, r); expect(0, r);
/* Case sensitivity. */
strcpy(f, "Foo");
fi.flags = LVFI_STRING;
fi.psz = f;
r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
ok(!r, "Unexpected item index %d.\n", r);
strcpy(f, "F");
fi.flags = LVFI_SUBSTRING;
fi.psz = f;
r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
ok(!r, "Unexpected item index %d.\n", r);
DestroyWindow(hwnd); DestroyWindow(hwnd);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment