Fix crash bug in unicode chars with Scintilla.

This commit is contained in:
Jeff Young 2020-05-28 00:18:28 +01:00
parent 8b084c373e
commit fe4fd19c66
4 changed files with 9 additions and 5 deletions

View File

@ -116,6 +116,10 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
{
m_te->Paste();
}
else if( aEvent.GetUnicodeKey() > 60 )
{
aEvent.Skip(); // This crashes the Scintilla engine....
}
else
{
aEvent.Skip();
@ -127,7 +131,7 @@ void SCINTILLA_TRICKS::onScintillaUpdateUI( wxStyledTextEvent& aEvent )
{
auto isBrace = [this]( int c ) -> bool
{
return m_braces.Find( (char) c ) >= 0;
return m_braces.Find( (wxChar) c ) >= 0;
};
// Has the caret changed position?

View File

@ -69,7 +69,7 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
m_valueMultiLine->SetEOLMode( wxSTC_EOL_LF );
m_scintillaTricks = new SCINTILLA_TRICKS( m_valueMultiLine, "()" );
m_scintillaTricks = new SCINTILLA_TRICKS( m_valueMultiLine, wxT( "()" ) );
if( m_CurrentText->IsMultilineAllowed() )
{

View File

@ -58,7 +58,7 @@ DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxS
m_fieldId = VALUE;
m_isPower = false;
m_scintillaTricks = new SCINTILLA_TRICKS( m_StyledTextCtrl, "{}" );
m_scintillaTricks = new SCINTILLA_TRICKS( m_StyledTextCtrl, wxT( "{}" ) );
m_text = aTextItem->GetText();
m_isItalic = aTextItem->IsItalic();

View File

@ -35,7 +35,7 @@ PANEL_SETUP_RULES::PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFr
m_frame( aFrame ),
m_scintillaTricks( nullptr )
{
m_scintillaTricks = new SCINTILLA_TRICKS( m_textEditor, "{}" );
m_scintillaTricks = new SCINTILLA_TRICKS( m_textEditor, wxT( "{}" ) );
int size = wxNORMAL_FONT->GetPointSize();
wxFont fixedFont( size, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL );
@ -76,7 +76,7 @@ void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
for( ; i < currentPos; ++i )
{
char c = (char) m_textEditor->GetCharAt( i );
wxChar c = m_textEditor->GetCharAt( i );
if( c == '\\' )
{