From cbff011e3c29f76c892ae5e9875f888fd1f9fc04 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 9 Apr 2023 11:06:01 +0100 Subject: [PATCH] Don't delete default intersheetrefs field from global labels. Fixes https://gitlab.com/kicad/code/kicad/issues/14493 (cherry picked from commit a226f7fc1471ee089bd9ffb577bcec42a89919e8) --- eeschema/sch_label.h | 5 +++++ eeschema/tools/sch_edit_tool.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_label.h b/eeschema/sch_label.h index 8378d4d748..a022daf5cb 100644 --- a/eeschema/sch_label.h +++ b/eeschema/sch_label.h @@ -100,6 +100,11 @@ public: m_fields = aFields; // vector copying, length is changed possibly } + void AddFields( const std::vector& aFields ) + { + m_fields.insert( m_fields.end(), aFields.begin(), aFields.end() ); + } + /** * Increment the label text, if it ends with a number. * diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index a340f802c6..f884d6b7dc 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -2165,7 +2165,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent ) SCH_LABEL_BASE* new_label = dynamic_cast( newtext ); if( label && new_label ) - new_label->SetFields( label->GetFields() ); + new_label->AddFields( label->GetFields() ); if( selected ) m_toolMgr->RunAction( EE_ACTIONS::removeItemFromSel, true, item );