private void beforeInsert(object sender, BeforeModificationEventArgs e) { if (CanUndoRedo) { UndoRedoStruct ne = new UndoRedoStruct(e, UndoRedoAction.Insert); undoRedoList.Add(ne); } int lineIndex = LineFromPosition(e.Position); Line Curl = Lines[lineIndex]; int linePos = Curl.Position; code.ClearFlags(); code.AddLinesAt(lineIndex, linePos, e.Position, e.Text); }