Class TextView | Terminal.Gui v2 (original) (raw)

Namespace

Terminal.Gui

Assembly

Terminal.Gui.dll

Multi-line text editing View.

public class TextView : View, IDisposable, ISupportInitializeNotification, ISupportInitialize

Inheritance

TextView

Implements

Inherited Members

Constructors

TextView()

Initializes a TextView on the specified area, with dimensions controlled with the X, Y, Width and Height properties.

Properties

AllowsReturn

Gets or sets whether pressing ENTER in a TextView creates a new line of text in the view or invokes the Accepting event.

AllowsTab

Gets or sets whether the TextView inserts a tab character into the text or ignores tab input. If set to false and the user presses the tab key (or shift-tab) the focus will move to the next view (or previous with shift-tab). The default is true; if the user presses the tab key, a tab character will be inserted into the text.

Autocomplete

Provides autocomplete context menu based on suggestions at the current cursor position. ConfigureSuggestionGenerator to enable this feature

ContextMenu

Get the Context Menu.

CurrentColumn

Gets the cursor column.

CurrentRow

Gets the current cursor row.

CursorPosition

Sets or gets the current cursor position.

HasHistoryChanges

Indicates whatever the text has history changes or not. true if the text has history changesfalse otherwise.

InheritsPreviousAttribute

If true and the current Attribute is null will inherit from the previous, otherwise if false (default) do nothing. If the text is load withLoad(List) this property is automatically sets to true.

IsDirty

Indicates whatever the text was changed or not. true if the text was changedfalse otherwise.

IsSelecting

Get or sets whether the user is currently selecting text.

LeftColumn

Gets or sets the left column.

Lines

Gets the number of lines.

Maxlength

Gets the maximum visible length line.

Multiline

Gets or sets a value indicating whether this TextView is a multiline text view.

ReadOnly

Gets or sets whether the TextView is in read-only mode or not

SelectedCellsList

Gets the selected text as List{List{Cell}}

SelectedLength

Length of the selected text.

SelectedText

The selected text.

SelectionStartColumn

Start column position of the selected text.

SelectionStartRow

Start row position of the selected text.

TabWidth

Gets or sets a value indicating the number of whitespace when pressing the TAB key.

Text

Sets or gets the text in the TextView.

TopRow

Gets or sets the top row.

Used

Tracks whether the text view should be considered "used", that is, that the user has moved in the entry, so new input should be appended at the cursor position, rather than clearing the entry

WordWrap

Allows word wrap the to fit the available container width.

Methods

ClearHistoryChanges()

Allows clearing the Terminal.Gui.HistoryText.HistoryTextItemEventArgs items updating the original text.

CloseFile()

Closes the contents of the stream into the TextView.

Copy()

Copy the selected text to the clipboard contents.

Cut()

Cut the selected text to the clipboard contents.

DeleteAll()

Deletes all text.

DeleteCharLeft()

Deletes all the selected or a single character at left from the position of the cursor.

DeleteCharRight()

Deletes all the selected or a single character at right from the position of the cursor.

Dispose(bool)

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

FindNextText(string, out bool, bool, bool, string?, bool)

Find the next text based on the match case with the option to replace it.

FindPreviousText(string, out bool, bool, bool, string?, bool)

Find the previous text based on the match case with the option to replace it.

FindTextChanged()

Reset the flag to stop continuous find.

GetAllLines()

Gets all lines of characters.

GetCurrentLine()

Returns the characters on the current line (where the cursor is positioned). Use CurrentColumnto determine the position of the cursor within that line

GetLine(int)

Returns the characters on the line.

GetNormalColor()

Determines the current ColorScheme based on the Enabled value.

InsertText(string)

Inserts the given toAdd text at the current cursor position exactly as if the user had just typed it

Load(List<List>)

Loads the contents of the list of Cell list into the TextView.

Load(List)

Loads the contents of the Cell list into the TextView.

Load(Stream)

Loads the contents of the stream into the TextView.

Load(string)

Loads the contents of the file into the TextView.

MoveEnd()

Will scroll the TextView to the last line and position the cursor there.

MoveHome()

Will scroll the TextView to the first line and position the cursor there.

OnContentsChanged()

Called when the contents of the TextView change. E.g. when the user types text or deletes text. Raises theContentsChanged event.

OnDrawNormalColor(List, int, int)

Sets the Driver to an appropriate color for rendering the given idxColof the current line. Override to provide custom coloring by callingSetAttribute(Attribute) Defaults to Normal.

OnDrawReadOnlyColor(List, int, int)

Sets the Driver to an appropriate color for rendering the given idxColof the current line. Override to provide custom coloring by callingSetAttribute(Attribute) Defaults to Focus.

OnDrawSelectionColor(List, int, int)

Sets the Driver to an appropriate color for rendering the given idxColof the current line. Override to provide custom coloring by callingSetAttribute(Attribute) Defaults to Focus.

OnDrawUsedColor(List, int, int)

Sets the Driver to an appropriate color for rendering the given idxColof the current line. Override to provide custom coloring by callingSetAttribute(Attribute) Defaults to HotFocus.

OnDrawingContent()

Called when the View's content is to be drawn. The default implementation does nothing.

OnHasFocusChanged(bool, View?, View?)

Invoked after HasFocus has changed. This method is called before the HasFocusChangedevent is raised.

OnKeyDown(Key)

Called when the user presses a key, allowing subscribers to pre-process the key down event. Called before key bindings are invoked and KeyDownNotHandled is raised. SetHandledto true to stop the key from being processed further.

OnKeyDownNotHandled(Key)

Called when the user has pressed key it wasn't handled by KeyDown and was not bound to a key binding.

OnKeyUp(Key)

Called when a key is released. This method is called from NewKeyUpEvent(Key).

OnMouseEvent(MouseEventArgs)

Called when a mouse event occurs within the view's Viewport.

OnUnwrappedCursorPosition(int?, int?)

Invoke the UnwrappedCursorPosition event with the unwrapped CursorPosition.

Paste()

Paste the clipboard contents into the current selected position.

PositionCursor()

Positions the cursor on the current row and column

PromptForColors()

Open a dialog to set the foreground and background colors.

Redo()

Redoes the latest changes.

ReplaceAllText(string, bool, bool, string?)

Replaces all the text based on the match case.

ScrollTo(int, bool)

Will scroll the TextView to display the specified row at the top if isRow is true or will scroll the TextView to display the specified column at the left ifisRow is false.

SelectAll()

Select all text.

SetNormalColor()

Sets the driver to the default color for the control where no text is being rendered. Defaults toNormal.

Undo()

Undoes the latest changes.

Events

ContentsChanged

Raised when the contents of the TextView are changed.

DrawNormalColor

Invoked when the normal color is drawn.

DrawReadOnlyColor

Invoked when the ready only color is drawn.

DrawSelectionColor

Invoked when the selection color is drawn.

DrawUsedColor

Invoked when the used color is drawn. The Used Color is used to indicate if the InsertCharwas pressed and enabled.

UnwrappedCursorPosition

Invoked with the unwrapped CursorPosition.