From cb6d67bab435fc1e2e1d55f4ee290c8bfeeebf0c Mon Sep 17 00:00:00 2001 From: AliKet Date: Mon, 23 Aug 2021 01:59:07 +0200 Subject: [PATCH] Reset selection on right click in a more efficient way Instead of using HighlightAll(), use the second argument of HighlightOnly() to remove selection from the previous current item. --- src/generic/listctrl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index bae4eba6bf..ab337f337f 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2682,9 +2682,9 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) // Multi-selections should not be cleared if a selected item is clicked. if (!IsHighlighted(current)) { - HighlightAll(false); + size_t oldCurrent = m_current; ChangeCurrent(current); - HighlightOnly(m_current); + HighlightOnly(m_current, oldCurrent); } SendNotify( current, wxEVT_LIST_ITEM_RIGHT_CLICK, event.GetPosition() );