EditableTextDocument class
Mutable text storage for editor consumers of the read-only text view contracts. Mutation and undo are intentionally kept outside the layout engine.
public sealed class EditableTextDocument : IReadOnlyTextDocumentPublic Members
Section titled “Public Members”| name | description |
|---|---|
| EditableTextDocument(…) | |
| static CreatePreservingLineEndings(…) | A document that keeps each line’s own terminator, so a file read into it round-trips unchanged. Every other document rewrites terminators to a line feed. |
| CanRedo { get; } | Whether there is an undone edit to redo. |
| CanUndo { get; } | Whether there is an edit to undo. |
| LineCount { get; } | |
| PreservesLineEndings { get; } | Whether the document keeps the line terminators it was given. |
| TextLength { get; } | |
| UndoSizeLimit { get; set; } | Most recent edits to keep, oldest dropped past it. Negative keeps every edit; zero records none, which is how a control that must not retain what was typed opts out of undo. A group counts as the edits it holds, and the limit never leaves half of one behind. |
| Version { get; } | |
| event Changed | |
| BeginUndoGroup() | Groups the edits made until the returned object is disposed into one undo step. Every edit still raises Changed as it happens, so a reader inside the group never sees stale text; only what undo treats as one step changes. Nesting extends the outermost group. |
| ClearUndoHistory() | Drops both stacks, so what is in the document becomes the starting point. A control that must not retain what was typed clears it; setting the text does so implicitly. |
| GetCharAt(…) | |
| GetLineByNumber(…) | |
| GetLineByOffset(…) | |
| GetLocation(…) | |
| GetOffset(…) | |
| GetText(…) | |
| Insert(…) | |
| Redo() | Redoes one step. False when there was nothing to redo. |
| Remove(…) | |
| Replace(…) | |
| SetText(…) | |
| override ToString() | |
| Undo() | Undoes one step. False when there was nothing to undo. The history belongs to the document rather than to a view, so a document with no editor undoes through this. |
See Also
Section titled “See Also”- interface IReadOnlyTextDocument
- namespace Aprillz.MewUI.Text.Editing