Class PlainTextEditor
- Namespace
- NanoByte.StructureEditor.EtoForms
- Assembly
- NanoByte.StructureEditor.EtoForms.dll
A plain monospaced text editor without syntax highlighting. Works on all platforms.
public class PlainTextEditor : ITextEditor
- Inheritance
-
objectPlainTextEditor
- Implements
Constructors
PlainTextEditor()
Creates a new plain text editor.
public PlainTextEditor()
Properties
Control
The control to display.
public Control Control { get; }
Property Value
- Control
Text
The text currently in the editor.
public string Text { get; }
Property Value
Methods
ClearError()
Removes any marker set by ShowError(int, int, string).
public void ClearError()
GetOffset(string, int, int)
Converts a line and column number to a character offset.
public static int GetOffset(string text, int line, int column)
Parameters
textstringThe text to navigate in.
lineintThe 1-based line number.
columnintThe 1-based column number.
Returns
- int
The 0-based character offset. Clamped to the bounds of the line and text.
NavigateTo(int, int)
Moves the caret to a location in the text and gives the editor the input focus.
public void NavigateTo(int line, int column)
Parameters
SetContent(string, string)
Replaces the text in the editor.
public void SetContent(string text, string formatName)
Parameters
textstringThe new text.
formatNamestringThe FormatName of the text (e.g., XML or JSON). May be used to determine syntax highlighting.
ShowError(int, int, string)
Marks a location in the text as erroneous, without moving the caret.
public void ShowError(int line, int column, string message)
Parameters
lineintThe 1-based line number of the error.
columnintThe 1-based column number of the error.
messagestringA message describing the error.
Events
TextChanged
Raised when the Text has been changed.
public event EventHandler<EventArgs>? TextChanged