Multiline text editing control.
    public class TextEdit : Control

TextEdit is meant for editing large, multiline text. It also has facilities for editing code, such as syntax highlighting support and multiple levels of undo/redo.

Inheritance Chain

Constructors

    public TextEdit()

Signals

    "breakpoint_toggled" (int row)

Emitted when a breakpoint is placed via the breakpoint gutter.

    "cursor_changed" ()

Emitted when the cursor changes.

    "info_clicked" (int row, String info)

Emitted when the info icon is clicked.

    "request_completion" ()

    "symbol_lookup" (String symbol, int row, int column)

    "text_changed" ()

Emitted when the text changes.

Properties

    public bool BreakpointGutter { get; set; }

If true, the breakpoint gutter is visible.

    public bool CaretBlink { get; set; }

If true, the caret (visual cursor) blinks.

    public float CaretBlinkSpeed { get; set; }

Duration (in seconds) of a caret’s blinking cycle.

    public bool CaretBlockMode { get; set; }

If true, the caret displays as a rectangle.

If false, the caret displays as a bar.

    public bool CaretMovingByRightClick { get; set; }

If true, a right-click moves the cursor at the mouse position before displaying the context menu.

If false, the context menu disregards mouse location.

    public bool ContextMenuEnabled { get; set; }

If true, a right-click displays the context menu.

    public bool DrawSpaces { get; set; }

If true, the “space” character will have a visible representation.

    public bool DrawTabs { get; set; }

If true, the “tab” character will have a visible representation.

    public bool FoldGutter { get; set; }

If true, the fold gutter is visible. This enables folding groups of indented lines.

    public bool HidingEnabled { get; set; }

If true, all lines that have been set to hidden by SetLineAsHidden(int, bool), will not be visible.

    public bool HighlightAllOccurrences { get; set; }

If true, all occurrences of the selected text will be highlighted.

    public bool HighlightCurrentLine { get; set; }

If true, the line containing the cursor is highlighted.

    public bool MinimapDraw { get; set; }

    public int MinimapWidth { get; set; }

    public bool OverrideSelectedFontColor { get; set; }

    public bool Readonly { get; set; }

If true, read-only mode is enabled. Existing text cannot be modified and new text cannot be added.

    public bool SelectingEnabled { get; set; }

    public bool ShortcutKeysEnabled { get; set; }

    public bool ShowLineNumbers { get; set; }

If true, line numbers are displayed to the left of the text.

    public bool SmoothScrolling { get; set; }

If true, sets the step of the scrollbars to 0.25 which results in smoother scrolling.

    public bool SyntaxHighlighting { get; set; }

If true, any custom color properties that have been set for this TextEdit will be visible.

    public string Text { get; set; }

String value of the TextEdit.

    public float VScrollSpeed { get; set; }

Vertical scroll sensitivity.

    public bool WrapEnabled { get; set; }

If true, enables text wrapping when it goes beyond the edge of what is visible.

Methods

    public void AddColorRegion(string beginKey, string endKey, Color color, bool lineOnly = false)

Adds color region (given the delimiters) and its colors.

    public void AddKeywordColor(string keyword, Color color)

Adds a keyword and its Color.

    public bool CanFold(int line)

Returns if the given line is foldable, that is, it has indented lines right below it.

    public void CenterViewportToCursor()

    public void ClearColors()

Clears all the syntax coloring information.

    public void ClearUndoHistory()

Clears the undo history.

    public void Copy()

Copy’s the current text selection.

    [Obsolete("CursorGetBlinkEnabled is deprecated. Use the CaretBlink property instead.")]
    public bool CursorGetBlinkEnabled()

Getter for CaretBlink

    [Obsolete("CursorGetBlinkSpeed is deprecated. Use the CaretBlinkSpeed property instead.")]
    public float CursorGetBlinkSpeed()

Getter for CaretBlinkSpeed

    public int CursorGetColumn()

Returns the column the editing cursor is at.

    public int CursorGetLine()

Returns the line the editing cursor is at.

    [Obsolete("CursorIsBlockMode is deprecated. Use the CaretBlockMode property instead.")]
    public bool CursorIsBlockMode()

Getter for CaretBlockMode

    [Obsolete("CursorSetBlinkEnabled is deprecated. Use the CaretBlink property instead.")]
    public void CursorSetBlinkEnabled(bool enable)

Setter for CaretBlink

    [Obsolete("CursorSetBlinkSpeed is deprecated. Use the CaretBlinkSpeed property instead.")]
    public void CursorSetBlinkSpeed(float blinkSpeed)

Setter for CaretBlinkSpeed

    [Obsolete("CursorSetBlockMode is deprecated. Use the CaretBlockMode property instead.")]
    public void CursorSetBlockMode(bool enable)

Setter for CaretBlockMode

    public void CursorSetColumn(int column, bool adjustViewport = true)

Moves the cursor at the specified column index.

If adjustViewport is set to true, the viewport will center at the cursor position after the move occurs.

    public void CursorSetLine(int line, bool adjustViewport = true, bool canBeHidden = true, int wrapIndex = 0)

Moves the cursor at the specified line index.

If adjustViewport is set to true, the viewport will center at the cursor position after the move occurs.

If canBeHidden is set to true, the specified line can be hidden using SetLineAsHidden(int, bool).

    public void Cut()

Cut’s the current selection.

    public void Deselect()

Deselects the current selection.

    [Obsolete("DrawMinimap is deprecated. Use the MinimapDraw property instead.")]
    public void DrawMinimap(bool draw)

Setter for MinimapDraw

    public void FoldAllLines()

Folds all lines that are possible to be folded (see CanFold(int)).

    public void FoldLine(int line)

Folds the given line, if possible (see CanFold(int)).

    public Godot.Collections.Array GetBreakpoints()

Returns an array containing the line number of each breakpoint.

    public Color GetKeywordColor(string keyword)

Returns the Color of the specified keyword.

    public string GetLine(int line)

Returns the text of a specific line.

    public int GetLineCount()

Returns the amount of total lines in the text.

    public PopupMenu GetMenu()

Returns the PopupMenu of this TextEdit. By default, this menu is displayed when right-clicking on the TextEdit.

    [Obsolete("GetMinimapWidth is deprecated. Use the MinimapWidth property instead.")]
    public int GetMinimapWidth()

Getter for MinimapWidth

    public int GetSelectionFromColumn()

Returns the selection begin column.

    public int GetSelectionFromLine()

Returns the selection begin line.

    public string GetSelectionText()

Returns the text inside the selection.

    public int GetSelectionToColumn()

Returns the selection end column.

    public int GetSelectionToLine()

Returns the selection end line.

    [Obsolete("GetText is deprecated. Use the Text property instead.")]
    public string GetText()

Getter for Text

    [Obsolete("GetVScrollSpeed is deprecated. Use the VScrollSpeed property instead.")]
    public float GetVScrollSpeed()

Getter for VScrollSpeed

    public string GetWordUnderCursor()

Returns a String text with the word under the mouse cursor location.

    public bool HasKeywordColor(string keyword)

Returns whether the specified keyword has a color set to it or not.

    public void InsertTextAtCursor(string text)

Insert the specified text at the cursor position.

    [Obsolete("IsBreakpointGutterEnabled is deprecated. Use the BreakpointGutter property instead.")]
    public bool IsBreakpointGutterEnabled()

Getter for BreakpointGutter

    [Obsolete("IsContextMenuEnabled is deprecated. Use the ContextMenuEnabled property instead.")]
    public bool IsContextMenuEnabled()

Getter for ContextMenuEnabled

    [Obsolete("IsDrawingFoldGutter is deprecated. Use the FoldGutter property instead.")]
    public bool IsDrawingFoldGutter()

Getter for FoldGutter

    [Obsolete("IsDrawingMinimap is deprecated. Use the MinimapDraw property instead.")]
    public bool IsDrawingMinimap()

Getter for MinimapDraw

    [Obsolete("IsDrawingSpaces is deprecated. Use the DrawSpaces property instead.")]
    public bool IsDrawingSpaces()

Getter for DrawSpaces

    [Obsolete("IsDrawingTabs is deprecated. Use the DrawTabs property instead.")]
    public bool IsDrawingTabs()

Getter for DrawTabs

    public bool IsFolded(int line)

Returns whether the line at the specified index is folded or not.

    [Obsolete("IsHidingEnabled is deprecated. Use the HidingEnabled property instead.")]
    public bool IsHidingEnabled()

Getter for HidingEnabled

    [Obsolete("IsHighlightAllOccurrencesEnabled is deprecated. Use the HighlightAllOccurrences property instead.")]
    public bool IsHighlightAllOccurrencesEnabled()

Getter for HighlightAllOccurrences

    [Obsolete("IsHighlightCurrentLineEnabled is deprecated. Use the HighlightCurrentLine property instead.")]
    public bool IsHighlightCurrentLineEnabled()

Getter for HighlightCurrentLine

    public bool IsLineHidden(int line)

Returns whether the line at the specified index is hidden or not.

    [Obsolete("IsOverridingSelectedFontColor is deprecated. Use the OverrideSelectedFontColor property instead.")]
    public bool IsOverridingSelectedFontColor()

Getter for OverrideSelectedFontColor

    [Obsolete("IsReadonly is deprecated. Use the Readonly property instead.")]
    public bool IsReadonly()

Getter for Readonly

    [Obsolete("IsRightClickMovingCaret is deprecated. Use the CaretMovingByRightClick property instead.")]
    public bool IsRightClickMovingCaret()

Getter for CaretMovingByRightClick

    [Obsolete("IsSelectingEnabled is deprecated. Use the SelectingEnabled property instead.")]
    public bool IsSelectingEnabled()

Getter for SelectingEnabled

    public bool IsSelectionActive()

Returns true if the selection is active.

    [Obsolete("IsShortcutKeysEnabled is deprecated. Use the ShortcutKeysEnabled property instead.")]
    public bool IsShortcutKeysEnabled()

Getter for ShortcutKeysEnabled

    [Obsolete("IsShowLineNumbersEnabled is deprecated. Use the ShowLineNumbers property instead.")]
    public bool IsShowLineNumbersEnabled()

Getter for ShowLineNumbers

    [Obsolete("IsSmoothScrollEnabled is deprecated. Use the SmoothScrolling property instead.")]
    public bool IsSmoothScrollEnabled()

Getter for SmoothScrolling

    [Obsolete("IsSyntaxColoringEnabled is deprecated. Use the SyntaxHighlighting property instead.")]
    public bool IsSyntaxColoringEnabled()

Getter for SyntaxHighlighting

    [Obsolete("IsWrapEnabled is deprecated. Use the WrapEnabled property instead.")]
    public bool IsWrapEnabled()

Getter for WrapEnabled

    public void MenuOption(int option)

Triggers a right-click menu action by the specified index. See MenuItems for a list of available indexes.

    public void Paste()

Paste the current selection.

    public void Redo()

Perform redo operation.

    public void RemoveBreakpoints()

Removes all the breakpoints. This will not fire the breakpoint_toggled signal.

    public int[] Search(string key, uint flags, int fromLine, int fromColumn)

    public void Select(int fromLine, int fromColumn, int toLine, int toColumn)

Perform selection, from line/column to line/column.

    public void SelectAll()

Select all the text.

    [Obsolete("SetBreakpointGutterEnabled is deprecated. Use the BreakpointGutter property instead.")]
    public void SetBreakpointGutterEnabled(bool enable)

Setter for BreakpointGutter

    [Obsolete("SetContextMenuEnabled is deprecated. Use the ContextMenuEnabled property instead.")]
    public void SetContextMenuEnabled(bool enable)

Setter for ContextMenuEnabled

    [Obsolete("SetDrawFoldGutter is deprecated. Use the FoldGutter property instead.")]
    public void SetDrawFoldGutter(bool arg0)

Setter for FoldGutter

    [Obsolete("SetDrawSpaces is deprecated. Use the DrawSpaces property instead.")]
    public void SetDrawSpaces(bool arg0)

Setter for DrawSpaces

    [Obsolete("SetDrawTabs is deprecated. Use the DrawTabs property instead.")]
    public void SetDrawTabs(bool arg0)

Setter for DrawTabs

    [Obsolete("SetHidingEnabled is deprecated. Use the HidingEnabled property instead.")]
    public void SetHidingEnabled(bool enable)

Setter for HidingEnabled

    [Obsolete("SetHighlightAllOccurrences is deprecated. Use the HighlightAllOccurrences property instead.")]
    public void SetHighlightAllOccurrences(bool enable)

Setter for HighlightAllOccurrences

    [Obsolete("SetHighlightCurrentLine is deprecated. Use the HighlightCurrentLine property instead.")]
    public void SetHighlightCurrentLine(bool enabled)

Setter for HighlightCurrentLine

    public void SetLineAsHidden(int line, bool enable)

If true, hides the line of the specified index.

    [Obsolete("SetMinimapWidth is deprecated. Use the MinimapWidth property instead.")]
    public void SetMinimapWidth(int width)

Setter for MinimapWidth

    [Obsolete("SetOverrideSelectedFontColor is deprecated. Use the OverrideSelectedFontColor property instead.")]
    public void SetOverrideSelectedFontColor(bool @override)

Setter for OverrideSelectedFontColor

    [Obsolete("SetReadonly is deprecated. Use the Readonly property instead.")]
    public void SetReadonly(bool enable)

Setter for Readonly

    [Obsolete("SetRightClickMovesCaret is deprecated. Use the CaretMovingByRightClick property instead.")]
    public void SetRightClickMovesCaret(bool enable)

Setter for CaretMovingByRightClick

    [Obsolete("SetSelectingEnabled is deprecated. Use the SelectingEnabled property instead.")]
    public void SetSelectingEnabled(bool enable)

Setter for SelectingEnabled

    [Obsolete("SetShortcutKeysEnabled is deprecated. Use the ShortcutKeysEnabled property instead.")]
    public void SetShortcutKeysEnabled(bool enable)

Setter for ShortcutKeysEnabled

    [Obsolete("SetShowLineNumbers is deprecated. Use the ShowLineNumbers property instead.")]
    public void SetShowLineNumbers(bool enable)

Setter for ShowLineNumbers

    [Obsolete("SetSmoothScrollEnable is deprecated. Use the SmoothScrolling property instead.")]
    public void SetSmoothScrollEnable(bool enable)

Setter for SmoothScrolling

    [Obsolete("SetSyntaxColoring is deprecated. Use the SyntaxHighlighting property instead.")]
    public void SetSyntaxColoring(bool enable)

Setter for SyntaxHighlighting

    [Obsolete("SetText is deprecated. Use the Text property instead.")]
    public void SetText(string text)

Setter for Text

    [Obsolete("SetVScrollSpeed is deprecated. Use the VScrollSpeed property instead.")]
    public void SetVScrollSpeed(float speed)

Setter for VScrollSpeed

    [Obsolete("SetWrapEnabled is deprecated. Use the WrapEnabled property instead.")]
    public void SetWrapEnabled(bool enable)

Setter for WrapEnabled

    public void ToggleFoldLine(int line)

Toggle the folding of the code block at the given line.

    public void Undo()

Perform undo operation.

    public void UnfoldLine(int line)

Unfolds the given line, if folded.

    public void UnhideAllLines()

Unhide all lines that were previously set to hidden by SetLineAsHidden(int, bool).

Inner Types

Name Value Description
Cut 0 Cuts (Copies and clears) the selected text.
Copy 1 Copies the selected text.
Paste 2 Pastes the clipboard text over the selected text (or at the cursor’s position).
Clear 3 Erases the whole [TextEdit] text.
SelectAll 4 Selects the whole [TextEdit] text.
Undo 5 Undoes the previous action.
Redo 6 Redoes the previous action.
Max 7 Represents the size of the [enum MenuItems] enum.

SearchFlags

Name Value Description
MatchCase 1 Match case when searching.
WholeWords 2 Match whole words when searching.
Backwards 4 Search from end to beginning.
Tags: