From 7ffdfb10676758898e963f36ed1deb6dfc40f009 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 14 Oct 2022 22:00:54 +0100 Subject: [PATCH] Clear Scintilla undo history after setting initial text. Fixes https://gitlab.com/kicad/code/kicad/issues/12650 --- eeschema/dialogs/dialog_field_properties.cpp | 5 +++++ eeschema/dialogs/dialog_lib_text_properties.cpp | 1 + eeschema/dialogs/dialog_lib_textbox_properties.cpp | 1 + eeschema/dialogs/dialog_text_properties.cpp | 1 + pagelayout_editor/dialogs/properties_frame.cpp | 1 + pcbnew/dialogs/dialog_text_properties.cpp | 1 + pcbnew/dialogs/dialog_textbox_properties.cpp | 1 + pcbnew/dialogs/panel_setup_rules.cpp | 2 ++ 8 files changed, 13 insertions(+) diff --git a/eeschema/dialogs/dialog_field_properties.cpp b/eeschema/dialogs/dialog_field_properties.cpp index abd8a5c322..4e18ab72a9 100644 --- a/eeschema/dialogs/dialog_field_properties.cpp +++ b/eeschema/dialogs/dialog_field_properties.cpp @@ -302,9 +302,14 @@ void DIALOG_FIELD_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent ) bool DIALOG_FIELD_PROPERTIES::TransferDataToWindow() { if( m_TextCtrl->IsShown() ) + { m_TextCtrl->SetValue( m_text ); + } else if( m_StyledTextCtrl->IsShown() ) + { m_StyledTextCtrl->SetValue( m_text ); + m_StyledTextCtrl->EmptyUndoBuffer(); + } m_fontCtrl->SetFontSelection( m_font ); diff --git a/eeschema/dialogs/dialog_lib_text_properties.cpp b/eeschema/dialogs/dialog_lib_text_properties.cpp index 0f137b13a1..03422a97ae 100644 --- a/eeschema/dialogs/dialog_lib_text_properties.cpp +++ b/eeschema/dialogs/dialog_lib_text_properties.cpp @@ -126,6 +126,7 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow() { m_textSize.SetValue( m_graphicText->GetTextWidth() ); m_StyledTextCtrl->SetValue( m_graphicText->GetText() ); + m_StyledTextCtrl->EmptyUndoBuffer(); m_fontCtrl->SetFontSelection( m_graphicText->GetFont() ); m_textColorSwatch->SetSwatchColor( m_graphicText->GetTextColor(), false ); diff --git a/eeschema/dialogs/dialog_lib_textbox_properties.cpp b/eeschema/dialogs/dialog_lib_textbox_properties.cpp index 79a8f052cc..1f9428464d 100644 --- a/eeschema/dialogs/dialog_lib_textbox_properties.cpp +++ b/eeschema/dialogs/dialog_lib_textbox_properties.cpp @@ -142,6 +142,7 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow() return false; m_textCtrl->SetValue( m_currentText->GetText() ); + m_textCtrl->EmptyUndoBuffer(); m_fontCtrl->SetFontSelection( m_currentText->GetFont() ); m_textSize.SetValue( m_currentText->GetTextWidth() ); diff --git a/eeschema/dialogs/dialog_text_properties.cpp b/eeschema/dialogs/dialog_text_properties.cpp index 67a8292029..ce57217e4d 100644 --- a/eeschema/dialogs/dialog_text_properties.cpp +++ b/eeschema/dialogs/dialog_text_properties.cpp @@ -205,6 +205,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow() // show text variable cross-references in a human-readable format m_textCtrl->SetValue( schematic.ConvertKIIDsToRefs( m_currentText->GetText() ) ); + m_textCtrl->EmptyUndoBuffer(); m_fontCtrl->SetFontSelection( m_currentText->GetFont() ); m_textSize.SetValue( m_currentText->GetTextWidth() ); diff --git a/pagelayout_editor/dialogs/properties_frame.cpp b/pagelayout_editor/dialogs/properties_frame.cpp index c8096c07dc..96ad589259 100644 --- a/pagelayout_editor/dialogs/properties_frame.cpp +++ b/pagelayout_editor/dialogs/properties_frame.cpp @@ -259,6 +259,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem ) // Replace our '\' 'n' sequence by the EOL char item->ReplaceAntiSlashSequence(); m_stcText->SetValue( item->m_FullText ); + m_stcText->EmptyUndoBuffer(); msg.Printf( wxT( "%d" ), item->m_IncrementLabel ); m_textCtrlTextIncrement->SetValue( msg ); diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index ec85e1361b..24fc2a16cc 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -233,6 +233,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow() m_MultiLineText->SetValue( converted ); m_MultiLineText->SetSelection( -1, -1 ); + m_MultiLineText->EmptyUndoBuffer(); } if( m_item->Type() == PCB_FP_TEXT_T && m_fpText ) diff --git a/pcbnew/dialogs/dialog_textbox_properties.cpp b/pcbnew/dialogs/dialog_textbox_properties.cpp index 13b4230b41..cdae8488a2 100644 --- a/pcbnew/dialogs/dialog_textbox_properties.cpp +++ b/pcbnew/dialogs/dialog_textbox_properties.cpp @@ -169,6 +169,7 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow() m_MultiLineText->SetValue( converted ); m_MultiLineText->SetSelection( -1, -1 ); + m_MultiLineText->EmptyUndoBuffer(); m_cbLocked->SetValue( m_item->IsLocked() ); diff --git a/pcbnew/dialogs/panel_setup_rules.cpp b/pcbnew/dialogs/panel_setup_rules.cpp index 5e45e8ccb2..a0aa9f116c 100644 --- a/pcbnew/dialogs/panel_setup_rules.cpp +++ b/pcbnew/dialogs/panel_setup_rules.cpp @@ -594,6 +594,8 @@ bool PANEL_SETUP_RULES::TransferDataToWindow() m_textEditor->AddText( str << '\n' ); } + m_textEditor->EmptyUndoBuffer(); + wxCommandEvent dummy; OnCompile( dummy ); }