From eca22b05b381dbfd20bfe66c2e9fc2c6ee5f8a03 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 22 Dec 2023 14:59:40 +0000 Subject: [PATCH] Restore pin selection after PlacePin(). Fixes https://gitlab.com/kicad/code/kicad/-/issues/16401 --- eeschema/tools/symbol_editor_move_tool.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/eeschema/tools/symbol_editor_move_tool.cpp b/eeschema/tools/symbol_editor_move_tool.cpp index 4ec42bdb41..7aad4b2cfb 100644 --- a/eeschema/tools/symbol_editor_move_tool.cpp +++ b/eeschema/tools/symbol_editor_move_tool.cpp @@ -329,12 +329,18 @@ bool SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COM try { LIB_PIN* curr_pin = (LIB_PIN*) selection.Front(); - // PlacePin() will clear the current selection, so we need to reset - // flags of the selected pin here: - if( !pinTool->PlacePin( curr_pin ) ) - restore_state = true; + + if( pinTool->PlacePin( curr_pin ) ) + { + // PlacePin() clears the current selection, which we don't want. Not only + // is it a poor user experience, but it also prevents us from doing the + // proper cleanup at the end of this routine (ie: clearing the edit flags). + m_selectionTool->AddItemToSel( curr_pin, true /*quiet mode*/ ); + } else - curr_pin->ClearEditFlags(); + { + restore_state = true; + } } catch( const boost::bad_pointer& e ) {