Handle string escaping for Find/Replace in labels.
Fixes https://gitlab.com/kicad/code/kicad/issues/12789
(cherry picked from commit ae9405a4d3
)
This commit is contained in:
parent
a09a3dfe68
commit
ede21ed6ae
|
@ -665,6 +665,26 @@ wxString SCH_TEXT::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
}
|
||||
|
||||
|
||||
bool SCH_TEXT::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const
|
||||
{
|
||||
return SCH_ITEM::Matches( UnescapeString( GetText() ), aSearchData );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_TEXT::Replace( const wxFindReplaceData& aSearchData, void* aAuxData )
|
||||
{
|
||||
wxFindReplaceData localSearchData( aSearchData );
|
||||
|
||||
if( Type() == SCH_LABEL_T || Type() == SCH_HIER_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
localSearchData.SetFindString( EscapeString( aSearchData.GetFindString(), CTX_NETNAME ) );
|
||||
localSearchData.SetReplaceString( EscapeString( aSearchData.GetReplaceString(), CTX_NETNAME ) );
|
||||
}
|
||||
|
||||
return EDA_TEXT::Replace( localSearchData );
|
||||
}
|
||||
|
||||
|
||||
wxString SCH_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Graphic Text '%s'" ), ShortenedShownText() );
|
||||
|
|
|
@ -210,15 +210,8 @@ public:
|
|||
virtual void Rotate90( bool aClockwise );
|
||||
virtual void MirrorSpinStyle( bool aLeftRight );
|
||||
|
||||
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override
|
||||
{
|
||||
return SCH_ITEM::Matches( GetText(), aSearchData );
|
||||
}
|
||||
|
||||
bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) override
|
||||
{
|
||||
return EDA_TEXT::Replace( aSearchData );
|
||||
}
|
||||
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
|
||||
bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) override;
|
||||
|
||||
virtual bool IsReplaceable() const override { return true; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue