comctl32/listview: Fix find using partial string logic.
This commit is contained in:
parent
90c4abe86f
commit
b7b7b7113e
|
@ -5949,12 +5949,13 @@ again:
|
|||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (lvItem.mask & LVIF_TEXT)
|
||||
{
|
||||
if (lpFindInfo->flags & LVFI_PARTIAL)
|
||||
{
|
||||
if (strstrW(lvItem.pszText, lpFindInfo->psz) == NULL) continue;
|
||||
WCHAR *p = strstrW(lvItem.pszText, lpFindInfo->psz);
|
||||
if (!p || p != lvItem.pszText) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5963,7 +5964,7 @@ again:
|
|||
}
|
||||
|
||||
if (!bNearest) return nItem;
|
||||
|
||||
|
||||
/* This is very inefficient. To do a good job here,
|
||||
* we need a sorted array of (x,y) item positions */
|
||||
LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position);
|
||||
|
|
|
@ -4023,7 +4023,7 @@ static void test_LVS_EX_TRANSPARENTBKGND(void)
|
|||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_ApproximateViewRect(void)
|
||||
static void test_approximate_viewrect(void)
|
||||
{
|
||||
HWND hwnd;
|
||||
DWORD ret;
|
||||
|
@ -4097,6 +4097,40 @@ static void test_ApproximateViewRect(void)
|
|||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_finditem(void)
|
||||
{
|
||||
LVFINDINFOA fi;
|
||||
static char f[5];
|
||||
HWND hwnd;
|
||||
DWORD r;
|
||||
|
||||
hwnd = create_listview_control(0);
|
||||
insert_item(hwnd, 0);
|
||||
|
||||
memset(&fi, 0, sizeof(fi));
|
||||
|
||||
/* full string search, inserted text was "foo" */
|
||||
strcpy(f, "foo");
|
||||
fi.flags = LVFI_STRING;
|
||||
fi.psz = f;
|
||||
r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
|
||||
expect(0, r);
|
||||
/* partial string search, inserted text was "foo" */
|
||||
strcpy(f, "fo");
|
||||
fi.flags = LVFI_STRING | LVFI_PARTIAL;
|
||||
fi.psz = f;
|
||||
r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
|
||||
expect(0, r);
|
||||
/* partial string search, part after start char */
|
||||
strcpy(f, "oo");
|
||||
fi.flags = LVFI_STRING | LVFI_PARTIAL;
|
||||
fi.psz = f;
|
||||
r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
|
||||
expect(-1, r);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
START_TEST(listview)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
|
@ -4154,7 +4188,8 @@ START_TEST(listview)
|
|||
test_indentation();
|
||||
test_getitemspacing();
|
||||
test_getcolumnwidth();
|
||||
test_ApproximateViewRect();
|
||||
test_approximate_viewrect();
|
||||
test_finditem();
|
||||
|
||||
if (!load_v6_module(&ctx_cookie, &hCtx))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue