From 20974115506413e97978a1ae832de0afe727bc75 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 7 May 2019 10:38:34 +0100 Subject: [PATCH] Refresh RequestSelection selection if all items were filtered out. If you have, for instance a pin selected and do a cmd-E we'll filter out the pin and then do nothing. We should instead treat it as a hover selection if everything got filtered. --- eeschema/tools/sch_selection_tool.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/eeschema/tools/sch_selection_tool.cpp b/eeschema/tools/sch_selection_tool.cpp index 8e2762155b..685af1879d 100644 --- a/eeschema/tools/sch_selection_tool.cpp +++ b/eeschema/tools/sch_selection_tool.cpp @@ -493,17 +493,8 @@ void SCH_SELECTION_TOOL::guessSelectionCandidates( SCH_COLLECTOR& collector, SELECTION& SCH_SELECTION_TOOL::RequestSelection( const KICAD_T aFilterList[] ) { - if( m_selection.Empty() ) - { - VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true ); - - clearSelection(); - SelectPoint( cursorPos, aFilterList ); - m_selection.SetIsHover( true ); - - return m_selection; - } - else // Trim an existing selection by aFilterList + // Filter an existing selection + if( !m_selection.Empty() ) { for( int i = m_selection.GetSize() - 1; i >= 0; --i ) { @@ -513,8 +504,19 @@ SELECTION& SCH_SELECTION_TOOL::RequestSelection( const KICAD_T aFilterList[] ) toggleSelection( item ); } - return m_selection; } + + // If nothing was selected, or we filtered everything out, do a hover selection + if( m_selection.Empty() ) + { + VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true ); + + clearSelection(); + SelectPoint( cursorPos, aFilterList ); + m_selection.SetIsHover( true ); + } + + return m_selection; }