Search Results for

    Show / Hide Table of Contents

    Class TextView

    Multi-line text editing View
    Inheritance
    System.Object
    Responder
    View
    TextView
    Implements
    System.IDisposable
    System.ComponentModel.ISupportInitializeNotification
    System.ComponentModel.ISupportInitialize
    Remarks

    TextView provides a multi-line text editor. Users interact with it with the standard Emacs commands for movement or the arrow keys.

    ShortcutAction performed
    Left cursor, Control-b Moves the editing point left.
    Right cursor, Control-f Moves the editing point right.
    Alt-b Moves one word back.
    Alt-f Moves one word forward.
    Up cursor, Control-p Moves the editing point one line up.
    Down cursor, Control-n Moves the editing point one line down
    Home key, Control-a Moves the cursor to the beginning of the line.
    End key, Control-e Moves the cursor to the end of the line.
    Control-Home Scrolls to the first line and moves the cursor there.
    Control-End Scrolls to the last line and moves the cursor there.
    Delete, Control-d Deletes the character in front of the cursor.
    Backspace Deletes the character behind the cursor.
    Control-k Deletes the text until the end of the line and replaces the kill buffer with the deleted text. You can paste this text in a different place by using Control-y.
    Control-y Pastes the content of the kill ring into the current position.
    Alt-d Deletes the word above the cursor and adds it to the kill ring. You can paste the contents of the kill ring with Control-y.
    Control-q Quotes the next input character, to prevent the normal processing of key handling to take place.
    Inherited Members
    View.Added
    View.Removed
    View.Enter
    View.Leave
    View.MouseEnter
    View.MouseLeave
    View.MouseClick
    View.CanFocusChanged
    View.EnabledChanged
    View.VisibleChanged
    View.HotKeyChanged
    View.HotKey
    View.HotKeySpecifier
    View.Shortcut
    View.ShortcutTag
    View.ShortcutAction
    View.Data
    View.Driver
    View.Subviews
    View.TabIndexes
    View.TabIndex
    View.TabStop
    View.Id
    View.IsCurrentTop
    View.WantMousePositionReports
    View.WantContinuousButtonPressed
    View.LayoutStyle
    View.Bounds
    View.X
    View.Y
    View.Width
    View.Height
    View.ForceValidatePosDim
    View.GetMinWidthHeight(Size)
    View.SetMinWidthHeight()
    View.TextFormatter
    View.SuperView
    View.UpdateTextFormatterText()
    View.ProcessResizeView()
    View.SetNeedsDisplay()
    View.ClearLayoutNeeded()
    View.SetNeedsDisplay(Rect)
    View.SetChildNeedsDisplay()
    View.Add(View)
    View.Add(View[])
    View.RemoveAll()
    View.Remove(View)
    View.BringSubviewToFront(View)
    View.SendSubviewToBack(View)
    View.SendSubviewBackwards(View)
    View.BringSubviewForward(View)
    View.Clear()
    View.Clear(Rect)
    View.ScreenToView(Int32, Int32)
    View.ClipToBounds()
    View.SetClip(Rect)
    View.DrawFrame(Rect, Int32, Boolean)
    View.DrawHotString(ustring, Attribute, Attribute)
    View.DrawHotString(ustring, Boolean, ColorScheme)
    View.Move(Int32, Int32, Boolean)
    View.HasFocus
    View.OnAdded(View)
    View.OnRemoved(View)
    View.Focused
    View.MostFocused
    View.ColorScheme
    View.AddRune(Int32, Int32, Rune)
    View.ClearNeedsDisplay()
    View.DrawContent
    View.OnDrawContent(Rect)
    View.DrawContentComplete
    View.OnDrawContentComplete(Rect)
    View.SetFocus()
    View.KeyPress
    View.InvokeKeybindings(KeyEvent)
    View.AddKeyBinding(Key, Command)
    View.ReplaceKeyBinding(Key, Key)
    View.ContainsKeyBinding(Key)
    View.ClearKeybindings()
    View.ClearKeybinding(Key)
    View.ClearKeybinding(Command)
    View.AddCommand(Command, Func<Nullable<Boolean>>)
    View.GetSupportedCommands()
    View.GetKeyFromCommand(Command)
    View.ProcessHotKey(KeyEvent)
    View.ProcessColdKey(KeyEvent)
    View.KeyDown
    View.OnKeyDown(KeyEvent)
    View.KeyUp
    View.EnsureFocus()
    View.FocusFirst()
    View.FocusLast()
    View.FocusPrev()
    View.FocusNext()
    View.LayoutStarted
    View.LayoutComplete
    View.Initialized
    View.LayoutSubviews()
    View.AutoSize
    View.PreserveTrailingSpaces
    View.TextAlignment
    View.VerticalTextAlignment
    View.TextDirection
    View.IsInitialized
    View.IsAdded
    View.Enabled
    View.Visible
    View.Border
    View.ToString()
    View.GetAutoSize()
    View.GetHotKeySpecifierLength(Boolean)
    View.GetTextFormatterBoundsSize()
    View.GetBoundsTextFormatterSize()
    View.OnMouseEnter(MouseEvent)
    View.OnMouseLeave(MouseEvent)
    View.OnMouseEvent(MouseEvent)
    View.OnMouseClick(View.MouseEventArgs)
    View.OnCanFocusChanged()
    View.OnEnabledChanged()
    View.OnVisibleChanged()
    View.Dispose(Boolean)
    View.BeginInit()
    View.EndInit()
    View.SetWidth(Int32, Int32)
    View.SetHeight(Int32, Int32)
    View.GetCurrentWidth(Int32)
    View.GetCurrentHeight(Int32)
    View.GetNormalColor()
    View.GetTopSuperView()
    Responder.Dispose()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Terminal.Gui
    Assembly: Terminal.Gui.dll
    Syntax
    public class TextView : View, IDisposable, ISupportInitializeNotification, ISupportInitialize

    Constructors

    | Improve this Doc View Source

    TextView()

    Initializes a TextView on the specified area, with dimensions controlled with the X, Y, Width and Height properties.
    Declaration
    public TextView()
    | Improve this Doc View Source

    TextView(Rect)

    Initializes a TextView on the specified area, with absolute position and size.
    Declaration
    public TextView(Rect frame)
    Parameters
    Type Name Description
    Rect frame

    Properties

    | Improve this Doc View Source

    AllowsReturn

    Gets or sets a value indicating whether pressing ENTER in a TextView creates a new line of text in the view or activates the default button for the toplevel.
    Declaration
    public bool AllowsReturn { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    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.
    Declaration
    public bool AllowsTab { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Autocomplete

    Provides autocomplete context menu based on suggestions at the current cursor position. Populate AllSuggestions to enable this feature
    Declaration
    public IAutocomplete Autocomplete { get; protected set; }
    Property Value
    Type Description
    IAutocomplete
    | Improve this Doc View Source

    BottomOffset

    The bottom offset needed to use a horizontal scrollbar or for another reason. This is only needed with the keyboard navigation.
    Declaration
    public int BottomOffset { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    CanFocus

    Declaration
    public override bool CanFocus { get; set; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    View.CanFocus
    | Improve this Doc View Source

    ContextMenu

    Get the ContextMenu for this view.
    Declaration
    public ContextMenu ContextMenu { get; }
    Property Value
    Type Description
    ContextMenu
    | Improve this Doc View Source

    CurrentColumn

    Gets the cursor column.
    Declaration
    public int CurrentColumn { get; }
    Property Value
    Type Description
    System.Int32 The cursor column.
    | Improve this Doc View Source

    CurrentRow

    Gets the current cursor row.
    Declaration
    public int CurrentRow { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    CursorPosition

    Sets or gets the current cursor position.
    Declaration
    public Point CursorPosition { get; set; }
    Property Value
    Type Description
    Point
    | Improve this Doc View Source

    DesiredCursorVisibility

    Get / Set the wished cursor when the field is focused
    Declaration
    public CursorVisibility DesiredCursorVisibility { get; set; }
    Property Value
    Type Description
    CursorVisibility
    | Improve this Doc View Source

    Frame

    Declaration
    public override Rect Frame { get; set; }
    Property Value
    Type Description
    Rect
    Overrides
    View.Frame
    | Improve this Doc View Source

    HasHistoryChanges

    Indicates whatever the text has history changes or not. true if the text has history changes false otherwise.
    Declaration
    public bool HasHistoryChanges { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsDirty

    Indicates whatever the text was changed or not. true if the text was changed false otherwise.
    Declaration
    public bool IsDirty { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    LeftColumn

    Gets or sets the left column.
    Declaration
    public int LeftColumn { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Lines

    Gets the number of lines.
    Declaration
    public int Lines { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Maxlength

    Gets the maximum visible length line.
    Declaration
    public int Maxlength { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Multiline

    Gets or sets a value indicating whether this TextView is a multiline text view.
    Declaration
    public bool Multiline { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    ReadOnly

    Gets or sets whether the TextView is in read-only mode or not
    Declaration
    public bool ReadOnly { get; set; }
    Property Value
    Type Description
    System.Boolean Boolean value(Default false)
    | Improve this Doc View Source

    RightOffset

    The right offset needed to use a vertical scrollbar or for another reason. This is only needed with the keyboard navigation.
    Declaration
    public int RightOffset { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    SelectedLength

    Length of the selected text.
    Declaration
    public int SelectedLength { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    SelectedText

    The selected text.
    Declaration
    public ustring SelectedText { get; }
    Property Value
    Type Description
    NStack.ustring
    | Improve this Doc View Source

    Selecting

    Get or sets the selecting.
    Declaration
    public bool Selecting { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    SelectionStartColumn

    Start column position of the selected text.
    Declaration
    public int SelectionStartColumn { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    SelectionStartRow

    Start row position of the selected text.
    Declaration
    public int SelectionStartRow { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    TabWidth

    Gets or sets a value indicating the number of whitespace when pressing the TAB key.
    Declaration
    public int TabWidth { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Text

    Sets or gets the text in the TextView.
    Declaration
    public override ustring Text { get; set; }
    Property Value
    Type Description
    NStack.ustring
    Overrides
    View.Text
    | Improve this Doc View Source

    TopRow

    Gets or sets the top row.
    Declaration
    public int TopRow { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    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
    Declaration
    public bool Used { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    WordWrap

    Allows word wrap the to fit the available container width.
    Declaration
    public bool WordWrap { get; set; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    ClearHistoryChanges()

    Allows clearing the Terminal.Gui.HistoryText.HistoryTextItem items updating the original text.
    Declaration
    public void ClearHistoryChanges()
    | Improve this Doc View Source

    CloseFile()

    Closes the contents of the stream into the TextView.
    Declaration
    public bool CloseFile()
    Returns
    Type Description
    System.Boolean true, if stream was closed, false otherwise.
    | Improve this Doc View Source

    ColorNormal()

    Sets the driver to the default color for the control where no text is being rendered. Defaults to Normal.
    Declaration
    protected virtual void ColorNormal()
    | Improve this Doc View Source

    ColorNormal(List<Rune>, Int32)

    Sets the Driver to an appropriate color for rendering the given idx of the current line. Override to provide custom coloring by calling SetAttribute(Attribute) Defaults to Normal.
    Declaration
    protected virtual void ColorNormal(List<Rune> line, int idx)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.Rune> line
    System.Int32 idx
    | Improve this Doc View Source

    ColorSelection(List<Rune>, Int32)

    Sets the Driver to an appropriate color for rendering the given idx of the current line. Override to provide custom coloring by calling SetAttribute(Attribute) Defaults to Focus.
    Declaration
    protected virtual void ColorSelection(List<Rune> line, int idx)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.Rune> line
    System.Int32 idx
    | Improve this Doc View Source

    ColorUsed(List<Rune>, Int32)

    Sets the Driver to an appropriate color for rendering the given idx of the current line. Override to provide custom coloring by calling SetAttribute(Attribute) Defaults to HotFocus.
    Declaration
    protected virtual void ColorUsed(List<Rune> line, int idx)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.Rune> line
    System.Int32 idx
    | Improve this Doc View Source

    Copy()

    Copy the selected text to the clipboard contents.
    Declaration
    public void Copy()
    | Improve this Doc View Source

    Cut()

    Cut the selected text to the clipboard contents.
    Declaration
    public void Cut()
    | Improve this Doc View Source

    DeleteAll()

    Deletes all text.
    Declaration
    public void DeleteAll()
    | Improve this Doc View Source

    DeleteCharLeft()

    Deletes all the selected or a single character at left from the position of the cursor.
    Declaration
    public void DeleteCharLeft()
    | Improve this Doc View Source

    DeleteCharRight()

    Deletes all the selected or a single character at right from the position of the cursor.
    Declaration
    public void DeleteCharRight()
    | Improve this Doc View Source

    FindNextText(ustring, out Boolean, Boolean, Boolean, ustring, Boolean)

    Find the next text based on the match case with the option to replace it.
    Declaration
    public bool FindNextText(ustring textToFind, out bool gaveFullTurn, bool matchCase = false, bool matchWholeWord = false, ustring textToReplace = null, bool replace = false)
    Parameters
    Type Name Description
    NStack.ustring textToFind The text to find.
    System.Boolean gaveFullTurn trueIf all the text was forward searched.falseotherwise.
    System.Boolean matchCase The match case setting.
    System.Boolean matchWholeWord The match whole word setting.
    NStack.ustring textToReplace The text to replace.
    System.Boolean replace trueIf is replacing.falseotherwise.
    Returns
    Type Description
    System.Boolean trueIf the text was found.falseotherwise.
    | Improve this Doc View Source

    FindPreviousText(ustring, out Boolean, Boolean, Boolean, ustring, Boolean)

    Find the previous text based on the match case with the option to replace it.
    Declaration
    public bool FindPreviousText(ustring textToFind, out bool gaveFullTurn, bool matchCase = false, bool matchWholeWord = false, ustring textToReplace = null, bool replace = false)
    Parameters
    Type Name Description
    NStack.ustring textToFind The text to find.
    System.Boolean gaveFullTurn trueIf all the text was backward searched.falseotherwise.
    System.Boolean matchCase The match case setting.
    System.Boolean matchWholeWord The match whole word setting.
    NStack.ustring textToReplace The text to replace.
    System.Boolean replace trueIf the text was found.falseotherwise.
    Returns
    Type Description
    System.Boolean trueIf the text was found.falseotherwise.
    | Improve this Doc View Source

    FindTextChanged()

    Reset the flag to stop continuous find.
    Declaration
    public void FindTextChanged()
    | Improve this Doc View Source

    GetCurrentLine()

    Returns the characters on the current line (where the cursor is positioned). Use CurrentColumn to determine the position of the cursor within that line
    Declaration
    public List<Rune> GetCurrentLine()
    Returns
    Type Description
    System.Collections.Generic.List<System.Rune>
    | Improve this Doc View Source

    InsertText(String)

    Inserts the given toAdd text at the current cursor position exactly as if the user had just typed it
    Declaration
    public void InsertText(string toAdd)
    Parameters
    Type Name Description
    System.String toAdd Text to add
    | Improve this Doc View Source

    LoadFile(String)

    Loads the contents of the file into the TextView.
    Declaration
    public bool LoadFile(string path)
    Parameters
    Type Name Description
    System.String path Path to the file to load.
    Returns
    Type Description
    System.Boolean true, if file was loaded, false otherwise.
    | Improve this Doc View Source

    LoadStream(Stream)

    Loads the contents of the stream into the TextView.
    Declaration
    public void LoadStream(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream Stream to load the contents from.
    | Improve this Doc View Source

    MouseEvent(MouseEvent)

    Declaration
    public override bool MouseEvent(MouseEvent ev)
    Parameters
    Type Name Description
    MouseEvent ev
    Returns
    Type Description
    System.Boolean
    Overrides
    Responder.MouseEvent(MouseEvent)
    | Improve this Doc View Source

    MoveEnd()

    Will scroll the TextView to the last line and position the cursor there.
    Declaration
    public void MoveEnd()
    | Improve this Doc View Source

    MoveHome()

    Will scroll the TextView to the first line and position the cursor there.
    Declaration
    public void MoveHome()
    | Improve this Doc View Source

    OnEnter(View)

    Declaration
    public override bool OnEnter(View view)
    Parameters
    Type Name Description
    View view
    Returns
    Type Description
    System.Boolean
    Overrides
    View.OnEnter(View)
    | Improve this Doc View Source

    OnKeyUp(KeyEvent)

    Declaration
    public override bool OnKeyUp(KeyEvent kb)
    Parameters
    Type Name Description
    KeyEvent kb
    Returns
    Type Description
    System.Boolean
    Overrides
    View.OnKeyUp(KeyEvent)
    | Improve this Doc View Source

    OnLeave(View)

    Declaration
    public override bool OnLeave(View view)
    Parameters
    Type Name Description
    View view
    Returns
    Type Description
    System.Boolean
    Overrides
    View.OnLeave(View)
    | Improve this Doc View Source

    Paste()

    Paste the clipboard contents into the current selected position.
    Declaration
    public void Paste()
    | Improve this Doc View Source

    PositionCursor()

    Positions the cursor on the current row and column
    Declaration
    public override void PositionCursor()
    Overrides
    View.PositionCursor()
    | Improve this Doc View Source

    ProcessKey(KeyEvent)

    Declaration
    public override bool ProcessKey(KeyEvent kb)
    Parameters
    Type Name Description
    KeyEvent kb
    Returns
    Type Description
    System.Boolean
    Overrides
    View.ProcessKey(KeyEvent)
    | Improve this Doc View Source

    Redraw(Rect)

    Declaration
    public override void Redraw(Rect bounds)
    Parameters
    Type Name Description
    Rect bounds
    Overrides
    View.Redraw(Rect)
    | Improve this Doc View Source

    ReplaceAllText(ustring, Boolean, Boolean, ustring)

    Replaces all the text based on the match case.
    Declaration
    public bool ReplaceAllText(ustring textToFind, bool matchCase = false, bool matchWholeWord = false, ustring textToReplace = null)
    Parameters
    Type Name Description
    NStack.ustring textToFind The text to find.
    System.Boolean matchCase The match case setting.
    System.Boolean matchWholeWord The match whole word setting.
    NStack.ustring textToReplace The text to replace.
    Returns
    Type Description
    System.Boolean trueIf the text was found.falseotherwise.
    | Improve this Doc View Source

    ScrollTo(Int32, Boolean)

    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 if isRow is false.
    Declaration
    public void ScrollTo(int idx, bool isRow = true)
    Parameters
    Type Name Description
    System.Int32 idx Row that should be displayed at the top or Column that should be displayed at the left, if the value is negative it will be reset to zero
    System.Boolean isRow If true (default) the idx is a row, column otherwise.
    | Improve this Doc View Source

    SelectAll()

    Select all text.
    Declaration
    public void SelectAll()

    Events

    | Improve this Doc View Source

    TextChanged

    Raised when the Text of the TextView changes.
    Declaration
    public event Action TextChanged
    Event Type
    Type Description
    System.Action

    Implements

    System.IDisposable
    System.ComponentModel.ISupportInitializeNotification
    System.ComponentModel.ISupportInitialize
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX