[REGEDIT] Block tree label edit if the delete accelerator has been pressed (#7610)

This commit is contained in:
Whindmar Saksit 2025-01-13 13:21:12 +01:00 committed by GitHub
parent a97fcf19ec
commit 087979eeb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -668,6 +668,8 @@ BOOL TreeWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
case TVN_BEGINLABELEDIT:
{
LPNMTVDISPINFO ptvdi = (LPNMTVDISPINFO)lParam;
HWND hWndFocus = GetFocus();
/* cancel label edit for rootkeys */
if (!TreeView_GetParent(g_pChildWnd->hTreeWnd, ptvdi->item.hItem) ||
!TreeView_GetParent(g_pChildWnd->hTreeWnd, TreeView_GetParent(g_pChildWnd->hTreeWnd, ptvdi->item.hItem)))
@ -678,6 +680,12 @@ BOOL TreeWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
{
*Result = FALSE;
}
/* cancel label edit if VK_DELETE accelerator opened a MessageBox */
if (hWndFocus != g_pChildWnd->hTreeWnd && hWndFocus != TreeView_GetEditControl(g_pChildWnd->hTreeWnd))
{
*Result = TRUE;
}
return TRUE;
}
case TVN_ENDLABELEDIT: