From 509793a5b433241049bd624858e45383a3e7bbb5 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 14 May 2018 17:49:30 +0200 Subject: [PATCH] =?UTF-8?q?Symbol=20editor:=20Inversion=20sign=20("~")=20i?= =?UTF-8?q?ncorectly=20=C3=B9managed=20in=20graphic=20texts.=20It=20was=20?= =?UTF-8?q?always=20replaced=20with=20space=20in=20a=20graphic=20text,=20b?= =?UTF-8?q?ut=20it=20should=20happens=20only=20in=20non=20quoted=20texts?= =?UTF-8?q?=20Now=20graphic=20texts=20containing=20'=20'=20or=20'~'=20or?= =?UTF-8?q?=20'"'=20are=20always=20quoted=20(work=20fine=20with=204.0=20ve?= =?UTF-8?q?rsion)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: lp:1771105 https://bugs.launchpad.net/kicad/+bug/1771105 --- eeschema/sch_legacy_plugin.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index 3869dc21f7..35c4a42d85 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -3076,13 +3076,17 @@ LIB_TEXT* SCH_LEGACY_PLUGIN_CACHE::loadText( std::unique_ptr< LIB_PART >& aPart, if( *line == '"' ) parseQuotedString( str, aReader, line, &line ); else + { parseUnquotedString( str, aReader, line, &line ); + // In old libs, "spaces" are replaced by '~' in unquoted strings: + str.Replace( "~", " " ); + } + if( !str.IsEmpty() ) { // convert two apostrophes back to double quote str.Replace( "''", "\"" ); - str.Replace( wxT( "~" ), wxT( " " ) ); } text->SetText( str ); @@ -3916,18 +3920,12 @@ void SCH_LEGACY_PLUGIN_CACHE::saveText( LIB_TEXT* aText, wxString text = aText->GetText(); - if( text.Contains( wxT( "~" ) ) || text.Contains( wxT( "\"" ) ) ) + if( text.Contains( wxT( " " ) ) || text.Contains( wxT( "~" ) ) || text.Contains( wxT( "\"" ) ) ) { // convert double quote to similar-looking two apostrophes text.Replace( wxT( "\"" ), wxT( "''" ) ); text = wxT( "\"" ) + text + wxT( "\"" ); } - else - { - // Spaces are not allowed in text because it is not double quoted: - // changed to '~' - text.Replace( wxT( " " ), wxT( "~" ) ); - } aFormatter->Print( 0, "T %g %d %d %d %d %d %d %s", aText->GetTextAngle(), aText->GetTextPos().x, aText->GetTextPos().y,