diff --git a/scintilla/src/UndoHistory.cxx b/scintilla/src/UndoHistory.cxx index c94d0690c..b08e3a3d0 100644 --- a/scintilla/src/UndoHistory.cxx +++ b/scintilla/src/UndoHistory.cxx @@ -316,6 +316,8 @@ const char *UndoHistory::AppendAction(ActionType at, Sci::Position position, con const char *dataNew = lengthData ? scraps->Push(data, lengthData) : nullptr; if (currentAction >= actions.SSize()) { actions.PushBack(); + } else { + actions.Truncate(currentAction+1); } actions.Create(currentAction, at, position, lengthData, mayCoalesce); currentAction++;