From 4987809fe3b887db4a03fc53f5777d8b17a3e367 Mon Sep 17 00:00:00 2001
From: Jeff Young <jeff@rokeby.ie>
Date: Tue, 26 Jul 2022 18:16:38 +0100
Subject: [PATCH] Make Scintilla paste a separate undo operation.

Fixes https://gitlab.com/kicad/code/kicad/issues/11756

(cherry picked from commit c3a5947fe6ba7129b12fb769b83d1267e1cc34c5)
---
 common/scintilla_tricks.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/scintilla_tricks.cpp b/common/scintilla_tricks.cpp
index 7ed95c8282..a6cad46344 100644
--- a/common/scintilla_tricks.cpp
+++ b/common/scintilla_tricks.cpp
@@ -228,7 +228,9 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
                 str = data.GetText();
 
                 ConvertSmartQuotesAndDashes( &str );
+                m_te->BeginUndoAction();
                 m_te->AddText( str );
+                m_te->EndUndoAction();
             }
 
             wxTheClipboard->Close();