From 598b140112a9369029321de3a3b0f0cf4772ac69 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 7 Jun 2019 22:06:41 -0700 Subject: [PATCH] eagle: Strip newlines from description Eeschema old format is line-terminated so the newlines in descriptions will break the schematic file if saved. Fixes: lp:1829707 * https://bugs.launchpad.net/kicad/+bug/1829707 (cherry picked from commit fb85612f81ccd05ef73a9365f17ee3ae3a1251f3) --- eeschema/sch_eagle_plugin.cpp | 1 + eeschema/symbol_tree_synchronizing_adapter.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_eagle_plugin.cpp b/eeschema/sch_eagle_plugin.cpp index 622db49e5a..e1bf1a90c1 100644 --- a/eeschema/sch_eagle_plugin.cpp +++ b/eeschema/sch_eagle_plugin.cpp @@ -676,6 +676,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex ) if( descriptionNode ) { des = descriptionNode->GetContent(); + des.Replace( "\n", "_", true ); m_currentSheet->SetName( des ); filename = des.ToStdString(); } diff --git a/eeschema/symbol_tree_synchronizing_adapter.cpp b/eeschema/symbol_tree_synchronizing_adapter.cpp index 944d331d0a..8347548a2b 100644 --- a/eeschema/symbol_tree_synchronizing_adapter.cpp +++ b/eeschema/symbol_tree_synchronizing_adapter.cpp @@ -222,7 +222,14 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie case 1: if( node->LibId == m_libMgr->GetCurrentLibId() ) - aVariant = m_libMgr->GetAlias( node->Name, node->Parent->Name )->GetDescription(); + { + auto alias = m_libMgr->GetAlias( node->Name, node->Parent->Name ); + + if( alias ) + aVariant = alias->GetDescription(); + else + aVariant = node->Desc; + } else aVariant = node->Desc; break;