From 85b04c1c24ced2709ff8f9e2a907bd8497042b6d Mon Sep 17 00:00:00 2001 From: taler21 <99262969+taler21@users.noreply.github.com> Date: Fri, 16 Feb 2024 13:29:27 +0100 Subject: [PATCH] Don't reset selection while Ctrl or Shift key is pressed Don't reset the selection in a generic multi-selection wxListCtrl while Ctrl or Shift key is pressed to be consistent with wxMSW behaviour. This commit is best viewed ignoring whitespace-only changes. Closes #24332. --- src/generic/listctrl.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 341b256cc7..21bc5fb92c 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2549,12 +2549,17 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) } else if (event.LeftDown()) { - // reset the selection and bail out - HighlightAll(false); - // generate a DESELECTED event for - // virtual multi-selection lists - if ( IsVirtual() && !IsSingleSel() ) - SendNotify( m_lineLastClicked, wxEVT_LIST_ITEM_DESELECTED ); + // reset the selection in multi-selection mode only when Ctrl and + // Shift keys are not pressed to mimic MSW behaviour + if ( IsSingleSel() || !(event.ControlDown() || event.ShiftDown()) ) + { + // reset the selection and bail out + HighlightAll(false); + // generate a DESELECTED event for + // virtual multi-selection lists + if ( IsVirtual() && !IsSingleSel() ) + SendNotify( m_lineLastClicked, wxEVT_LIST_ITEM_DESELECTED ); + } } return;