mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 10:43:15 +02:00
Don't hang when trying to paste image as text.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19079
This commit is contained in:
parent
302dfb4623
commit
5caaf22949
@ -970,7 +970,15 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
|
|||||||
{
|
{
|
||||||
// If it's not a symbol then paste as text
|
// If it's not a symbol then paste as text
|
||||||
newPart = new LIB_SYMBOL( "dummy_part" );
|
newPart = new LIB_SYMBOL( "dummy_part" );
|
||||||
SCH_TEXT* newText = new SCH_TEXT( { 0, 0 }, clipboardData, LAYER_DEVICE );
|
|
||||||
|
wxString pasteText( clipboardData );
|
||||||
|
|
||||||
|
// Limit of 5000 is totally arbitrary. Without a limit, pasting a bitmap image from
|
||||||
|
// eeschema makes KiCad appear to hang.
|
||||||
|
if( pasteText.Length() > 5000 )
|
||||||
|
pasteText = pasteText.Left( 5000 ) + wxT( "..." );
|
||||||
|
|
||||||
|
SCH_TEXT* newText = new SCH_TEXT( { 0, 0 }, pasteText, LAYER_DEVICE );
|
||||||
newPart->AddDrawItem( newText );
|
newPart->AddDrawItem( newText );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user