From a9ba612fe47112bd476fbc42a1f232097e993b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Thu, 19 Jul 2012 13:32:57 +0000 Subject: clist_modern - Fix for ESC in clist_modern - Compatibility fix for searching with disabled filtering git-svn-id: http://svn.miranda-ng.org/main/trunk@1043 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clc.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'plugins/Clist_modern') diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index bd4b53c681..56375d2f0d 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -333,13 +333,15 @@ static int clcSearchNextContact(HWND hwnd, struct ClcData *dat, int index, const } if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) { - TCHAR* lowered = CharLowerW(NEWTSTR_ALLOCA(group->cl.items[group->scanIndex]->szText)); - if (_tcsstr(lowered, dat->szQuickSearch)) - - //if ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, group->cl.items[group->scanIndex]->szText, testlen)) || - // (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))) - - { + bool found; + if (dat->filterSearch) { + TCHAR* lowered_szText = CharLowerW(NEWTSTR_ALLOCA(group->cl.items[group->scanIndex]->szText)); + TCHAR* lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch)); + found = _tcsstr(lowered_szText, lowered_search) != NULL; + } else { + found = ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, group->cl.items[group->scanIndex]->szText, testlen)) || (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))); + } + if (found) { struct ClcGroup *contactGroup = group; int contactScanIndex = group->scanIndex; int foundindex; @@ -651,10 +653,6 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa dat->iInsertionMark = -1; dat->dragStage = 0; ReleaseCapture(); - } else if (dat->filterSearch && dat->szQuickSearch[0] != '\0') { - dat->szQuickSearch[0] = 0; - pcli->pfnSaveStateAndRebuildList(hwnd, dat); - //pcli->pfnInvalidateRect(hwnd, NULL, FALSE); } return 0; } -- cgit v1.2.3