Commit 850ea2a7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/listview: Add support for LVFI_SUBSTRING.

parent b7b7b711
......@@ -5888,7 +5888,8 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart,
if (!lpFindInfo || nItem < 0) return -1;
lvItem.mask = 0;
if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL))
if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL) ||
lpFindInfo->flags & LVFI_SUBSTRING)
{
lvItem.mask |= LVIF_TEXT;
lvItem.pszText = szDispText;
......@@ -5952,7 +5953,7 @@ again:
if (lvItem.mask & LVIF_TEXT)
{
if (lpFindInfo->flags & LVFI_PARTIAL)
if (lpFindInfo->flags & (LVFI_PARTIAL | LVFI_SUBSTRING))
{
WCHAR *p = strstrW(lvItem.pszText, lpFindInfo->psz);
if (!p || p != lvItem.pszText) continue;
......@@ -6009,7 +6010,8 @@ again:
static INT LISTVIEW_FindItemA(const LISTVIEW_INFO *infoPtr, INT nStart,
const LVFINDINFOA *lpFindInfo)
{
BOOL hasText = lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL);
BOOL hasText = lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL) ||
lpFindInfo->flags & LVFI_SUBSTRING;
LVFINDINFOW fiw;
INT res;
LPWSTR strW = NULL;
......
......@@ -4128,6 +4128,35 @@ static void test_finditem(void)
r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
expect(-1, r);
/* try with LVFI_SUBSTRING */
strcpy(f, "fo");
fi.flags = LVFI_SUBSTRING;
fi.psz = f;
r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
if (r == -1)
{
win_skip("LVFI_SUBSTRING not supported\n");
DestroyWindow(hwnd);
return;
}
expect(0, r);
strcpy(f, "f");
fi.flags = LVFI_SUBSTRING;
fi.psz = f;
r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
expect(0, r);
strcpy(f, "o");
fi.flags = LVFI_SUBSTRING;
fi.psz = f;
r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
expect(-1, r);
strcpy(f, "f");
fi.flags = LVFI_SUBSTRING | LVFI_STRING;
fi.psz = f;
r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
expect(0, r);
DestroyWindow(hwnd);
}
......
......@@ -3023,11 +3023,12 @@ static const WCHAR WC_LISTVIEWW[] = { 'S','y','s',
#define LVSICF_NOSCROLL 0x0002
#define LVFI_PARAM 0X0001
#define LVFI_STRING 0X0002
#define LVFI_PARTIAL 0X0008
#define LVFI_WRAP 0X0020
#define LVFI_NEARESTXY 0X0040
#define LVFI_PARAM 0x0001
#define LVFI_STRING 0x0002
#define LVFI_SUBSTRING 0x0004
#define LVFI_PARTIAL 0x0008
#define LVFI_WRAP 0x0020
#define LVFI_NEARESTXY 0x0040
#define LVIF_TEXT 0x0001
#define LVIF_IMAGE 0x0002
......
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