Multiline text editing 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.
[b]Note:[/b] When holding down [kbd]Alt[/kbd], the vertical scroll wheel will scroll 5 times as fast as it would normally do. This also works in the Godot script editor.
Overide this method to define what happens when the user presses the backspace key.
Overide this method to define what happens when the user performs a copy.
Overide this method to define what happens when the user perfroms a cut.
Overide this method to define what happens when the types in the provided key [code]unicode[/code].
Overide this method to define what happens when the user perfroms a paste.
Called when the user presses the backspace key. Can be overriden with [method _backspace].
Centers the viewport on the line the editing cursor is at. This also resets the [member scroll_horizontal] value to [code]0[/code].
Removes all OpenType features.
Clears the undo history.
Copy's the current text selection. Can be overriden with [method _copy].
Cut's the current selection. Can be overriden with [method _cut].
Deselects the current selection.
Returns the column the editing caret is at.
Gets the caret pixel draw poistion.
Returns the line the editing caret is on.
Returns the wrap index the editing caret is on.
Returns the indent level of a specific line.
Returns the text of a specific line.
Returns the current background color of the line. [code]Color(0, 0, 0, 0)[/code] is returned if no color is set.
Returns the amount of total lines in the text.
Returns the number of the time given line is wrapped.
Returns the wrap index of the given line column.
Returns an array of [String] repersenting each wrapped index.
Returns the [PopupMenu] of this [TextEdit]. By default, this menu is displayed when right-clicking on the [TextEdit].
Returns OpenType feature [code]tag[/code].
Returns the selection begin column.
Returns the selection begin line.
Returns the text inside the selection.
Returns the selection end column.
Returns the selection end line.
Returns the [TextEdit]'s' tab size.
Returns the number of visible lines, including wrapped text.
Returns a [String] text with the word under the caret location.
Returns [code]true[/code] if the user is has a selection.
Insert the specified text at the caret position.
Returns [code]true[/code] if the caret is visible on the screen.
Returns whether the menu is visible. Use this instead of [code]get_menu().visible[/code] to improve performance (so the creation of the menu is avoided).
Returns if the given line is wrapped.
Triggers a right-click menu action by the specified index. See [enum MenuItems] for a list of available indexes.
Paste the current selection. Can be overriden with [method _paste].
Perform redo operation.
Perform a search inside the text. Search flags can be specified in the [enum SearchFlags] enum.
Returns an empty [code]Dictionary[/code] if no result was found. Otherwise, returns a [code]Dictionary[/code] containing [code]line[/code] and [code]column[/code] entries, e.g:
[codeblocks]
[gdscript]
var result = search("print", SEARCH_WHOLE_WORDS, 0, 0)
if !result.empty():
# Result found.
var line_number = result.line
var column_number = result.column
[/gdscript]
[csharp]
int[] result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0);
if (result.Length > 0)
{
// Result found.
int lineNumber = result[(int)TextEdit.SearchResult.Line];
int columnNumber = result[(int)TextEdit.SearchResult.Column];
}
[/csharp]
[/codeblocks]
Perform selection, from line/column to line/column.
If [member selecting_enabled] is [code]false[/code], no selection will occur.
Select all the text.
If [member selecting_enabled] is [code]false[/code], no selection will occur.
Selects the word under the caret.
Moves the caret to the specified [code]column[/code] index.
If [code]adjust_viewport[/code] is set to [code]true[/code], the viewport will center at the caret position after the move occurs.
Moves the caret to the specified [code]line[/code] index.
If [code]adjust_viewport[/code] is set to [code]true[/code], the viewport will center at the caret position after the move occurs.
If [code]can_be_hidden[/code] is set to [code]true[/code], the specified [code]line[/code] can be hidden.
Sets the text for a specific line.
Sets the current background color of the line. Set to [code]Color(0, 0, 0, 0)[/code] for no color.
Sets OpenType feature [code]tag[/code]. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url].
Sets the tab size for the [TextEdit] to use.
Perform undo operation.
Sets if the caret should blink.
Duration (in seconds) of a caret's blinking cycle.
Allow moving caret, selecting and removing the individual composite character components.
Note: [kbd]Backspace[/kbd] is always removing individual composite character components.
If [code]true[/code], a right-click moves the caret at the mouse position before displaying the context menu.
If [code]false[/code], the context menu disregards mouse location.
Set the type of caret to draw.
If [code]true[/code], a right-click displays the context menu.
If [code]true[/code], control characters are displayed.
If [code]true[/code], the "space" character will have a visible representation.
If [code]true[/code], the "tab" character will have a visible representation.
If [code]true[/code], all occurrences of the selected text will be highlighted.
If [code]true[/code], the line containing the cursor is highlighted.
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
If [code]true[/code], a minimap is shown, providing an outline of your source code.
The width, in pixels, of the minimap.
If [code]true[/code], custom [code]font_selected_color[/code] will be used for selected text.
If [code]true[/code], read-only mode is enabled. Existing text cannot be modified and new text cannot be added.
If there is a horizontal scrollbar, this determines the current horizontal scroll value in pixels.
If there is a vertical scrollbar, this determines the current vertical scroll value in line numbers, starting at 0 for the top line.
If [code]true[/code], text can be selected.
If [code]false[/code], text can not be selected by the user or by the [method select] or [method select_all] methods.
If [code]true[/code], shortcut keys for context menu items are enabled, even if the context menu is disabled.
If [code]true[/code], sets the [code]step[/code] of the scrollbars to [code]0.25[/code] which results in smoother scrolling.
Set BiDi algorithm override for the structured text.
Set additional options for BiDi override.
Sets the [SyntaxHighlighter] to use.
String value of the [TextEdit].
Base text writing direction.
Vertical scroll sensitivity.
If [code]true[/code], the native virtual keyboard is shown when focused on platforms that support it.
Sets the line wrapping mode to use.
Emitted when the caret changes position.
Emitted when the text changes.
Match case when searching.
Match whole words when searching.
Search from end to beginning.
Vertical line caret.
Block caret.
Line wrapping is disabled.
Line wrapping occurs at the control boundary, beyond what would normally be visible.
Cuts (copies and clears) the selected text.
Copies the selected text.
Pastes the clipboard text over the selected text (or at the cursor's position).
Erases the whole [TextEdit] text.
Selects the whole [TextEdit] text.
Undoes the previous action.
Redoes the previous action.
Sets text direction to inherited.
Sets text direction to automatic.
Sets text direction to left-to-right.
Sets text direction to right-to-left.
Toggles control character display.
Inserts left-to-right mark (LRM) character.
Inserts right-to-left mark (RLM) character.
Inserts start of left-to-right embedding (LRE) character.
Inserts start of right-to-left embedding (RLE) character.
Inserts start of left-to-right override (LRO) character.
Inserts start of right-to-left override (RLO) character.
Inserts pop direction formatting (PDF) character.
Inserts Arabic letter mark (ALM) character.
Inserts left-to-right isolate (LRI) character.
Inserts right-to-left isolate (RLI) character.
Inserts first strong isolate (FSI) character.
Inserts pop direction isolate (PDI) character.
Inserts zero width joiner (ZWJ) character.
Inserts zero width non-joiner (ZWNJ) character.
Inserts word joiner (WJ) character.
Inserts soft hyphen (SHY) character.
Represents the size of the [enum MenuItems] enum.
Sets the background [Color] of this [TextEdit].
[Color] of the text behind the caret when block caret is enabled.
[Color] of the caret.
Background [Color] of the line containing the caret.
Sets the [StyleBox] when in focus.
Sets the default [Font].
Sets the font [Color].
The tint of text outline of the [TextEdit].
Sets the font [Color] when [member readonly] is enabled.
Sets the [Color] of the selected text. [member override_selected_font_color] has to be enabled.
Sets default font size.
Sets the spacing between the lines.
Sets the [StyleBox] of this [TextEdit].
The size of the text outline.
Sets the [StyleBox] of this [TextEdit] when [member readonly] is enabled.
Sets the highlight [Color] of text selections.
Sets a custom [Texture2D] for space text characters.
Sets a custom [Texture2D] for tab text characters.
Sets the highlight [Color] of multiple occurrences. [member highlight_all_occurrences] has to be enabled.