From 6938f9a6faf85e0d7ae81fc36174772d52caa47c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 10 Apr 2020 19:47:43 +0300 Subject: fixes #2311 (Collapse multiple nested contact list groups with arrow keys) --- src/mir_app/src/clc.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 3e529e2e02..31f5c078f1 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -715,19 +715,27 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (hit == -1) return 0; - if (changeGroupExpand == 1 && contact->type == CLCIT_CONTACT) { - if (group == &dat->list) - return 0; - dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, group, -1); - selMoved = 1; - } - else { - if (contact->type == CLCIT_GROUP) - g_clistApi.pfnSetGroupExpand(hwnd, dat, contact->group, changeGroupExpand == 2); - return 0; + if (changeGroupExpand == 1) { + switch (contact->type) { + case CLCIT_GROUP: + if (contact->group->expanded) + break; + __fallthrough; + case CLCIT_CONTACT: + if (group == &dat->list) + return 0; + dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, group, -1); + goto LBL_MoveSelection; + } } + + if (contact->type == CLCIT_GROUP) + g_clistApi.pfnSetGroupExpand(hwnd, dat, contact->group, changeGroupExpand == 2); + return 0; } + if (selMoved) { +LBL_MoveSelection: if (!dat->bFilterSearch) dat->szQuickSearch[0] = 0; if (dat->selection >= g_clistApi.pfnGetGroupContentsCount(&dat->list, 1)) -- cgit v1.2.3