From 9861ed1a5f81d0d3d9522341f19d2623df56b1a9 Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <seth@kipro-pcb.com>
Date: Mon, 23 Jan 2023 13:16:38 -0800
Subject: [PATCH] Don't special case power symbol re-annotation

When the designer asks to reset annotations, we reset all annotations
including power symbols.  This may create additional churn in the files
but only when requested and is useful to fix schematic errors

Fixes https://gitlab.com/kicad/code/kicad/issues/13138
---
 eeschema/annotate.cpp                             | 2 +-
 eeschema/sch_reference_list.h                     | 7 ++-----
 qa/unittests/eeschema/test_sch_reference_list.cpp | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp
index bee46330ef..22b1bc6021 100644
--- a/eeschema/annotate.cpp
+++ b/eeschema/annotate.cpp
@@ -320,7 +320,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T  aAnnotateScope,
     // that these references must be reannotated, but keeps the original reference
     // so that we can reannotate multi-unit symbols together.
     if( aResetAnnotation )
-        references.RemoveAnnotation( false );
+        references.RemoveAnnotation();
 
     // Build additional list of references to be used during reannotation
     // to avoid duplicate designators (no additional references when annotating
diff --git a/eeschema/sch_reference_list.h b/eeschema/sch_reference_list.h
index d83340e588..92dea919bf 100644
--- a/eeschema/sch_reference_list.h
+++ b/eeschema/sch_reference_list.h
@@ -327,13 +327,10 @@ public:
      * symbols.
      * @see SCH_REFERENCE_LIST::UpdateAnnotation
      */
-    void RemoveAnnotation( bool aIncludePowerSymbols )
+    void RemoveAnnotation()
     {
         for( unsigned ii = 0; ii < GetCount(); ii++ )
-        {
-            if( !m_flatList[ii].m_libPart->IsPower() || aIncludePowerSymbols )
-                m_flatList[ii].m_isNew = true;
-        }
+            m_flatList[ii].m_isNew = true;
     }
 
     /**
diff --git a/qa/unittests/eeschema/test_sch_reference_list.cpp b/qa/unittests/eeschema/test_sch_reference_list.cpp
index f33746c54b..7b90c1e050 100644
--- a/qa/unittests/eeschema/test_sch_reference_list.cpp
+++ b/qa/unittests/eeschema/test_sch_reference_list.cpp
@@ -248,7 +248,7 @@ BOOST_AUTO_TEST_CASE( Reannotate )
 
         loadTestCase( c.m_SchematicRelativePath, c.m_ExpectedReannotations );
 
-        m_refsToReannotate.RemoveAnnotation( true );
+        m_refsToReannotate.RemoveAnnotation();
         m_refsToReannotate.SplitReferences();
         m_refsToReannotate.Annotate( false, 0, c.m_StartNumber, m_lockedRefs, getAdditionalRefs() );
         m_refsToReannotate.UpdateAnnotation();