Table of Contents

Property UndoList

Namespace
Alternet.Editor.TextSource
Assembly
Alternet.Editor.v9.dll

UndoList

Provides an indexed access to undo data.

[Browsable(false)]
public virtual IUndoList UndoList { get; }

Property Value

IUndoList

Examples

Here is how to use a UndoList in the C# code:

using System;

using Alternet.Editor;
using Alternet.Editor.TextSource;

public partial class Form1 : Form
{
    private TextSource textSource;
    private void Form1_Load(object sender, EventArgs e)
    {
        var syntaxEdit = new SyntaxEdit(this.components);
        textSource = new TextSource(this.components);
        textSource.LoadFile("myfile.txt");

        syntaxEdit.Source = this.textSource;
    }

    private void Button_Click(object sender, EventArgs e)
    {
        foreach (UndoData undoData in textSource.UndoList)
        {
            Console.WriteLine(undoData.Operation);
        }
    }
}

Here is how to use a UndoList in the Visual Basic code:

Imports System

Imports Alternet.Editor
Imports Alternet.Editor.TextSource

Partial Public Class Form1
    Inherits Form

    Private textSource As TextSource

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim syntaxEdit = New SyntaxEdit(Me.components)
        textSource = New TextSource(Me.components)
        textSource.LoadFile("myfile.txt")

        syntaxEdit.Source = Me.textSource
    End Sub

    Private Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
        For Each undoData As UndoData In textSource.UndoList
            Console.WriteLine(undoData.Operation)
        Next
    End Sub
End Class

Remarks

TextSource can store an unlimited number of the undo\redo operations unless UndoLimit property specifies otherwise.

Any operation performed within the text, such as text insertion or deletion, is automatically added to the UndoList so that it can be undone.