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 [code]Alt[/code], the vertical scroll wheel will scroll 5 times as fast as it would normally do. This also works in the Godot script editor.
Adds color region (given the delimiters) and its colors.
Adds a [code]keyword[/code] and its [Color].
Returns if the given line is foldable, that is, it has indented lines right below it.
Centers the viewport on the line the editing cursor is at. This also resets the [member scroll_horizontal] value to [code]0[/code].
Clears all custom syntax coloring information previously added with [method add_color_region] or [method add_keyword_color].
Clears the undo history.
Copy's the current text selection.
Returns the column the editing cursor is at.
Returns the line the editing cursor is at.
Moves the cursor at the specified [code]column[/code] index.
If [code]adjust_viewport[/code] is set to [code]true[/code], the viewport will center at the cursor position after the move occurs.
Moves the cursor at the specified [code]line[/code] index.
If [code]adjust_viewport[/code] is set to [code]true[/code], the viewport will center at the cursor 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 using [method set_line_as_hidden].
Cut's the current selection.
Deselects the current selection.
Folds all lines that are possible to be folded (see [method can_fold]).
Folds the given line, if possible (see [method can_fold]).
Returns an array containing the line number of each breakpoint.
Returns the [Color] of the specified [code]keyword[/code].
Returns the text of a specific line.
Returns the amount of total lines in the text.
Returns the [PopupMenu] of this [TextEdit]. By default, this menu is displayed when right-clicking on the [TextEdit].
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 a [String] text with the word under the caret (text cursor) location.
Returns whether the specified [code]keyword[/code] has a color set to it or not.
Returns [code]true[/code] if a "redo" action is available.
Returns [code]true[/code] if an "undo" action is available.
Insert the specified text at the cursor position.
Returns whether the line at the specified index is folded or not.
Returns whether the line at the specified index is hidden or not.
Returns [code]true[/code] when the specified [code]line[/code] is bookmarked.
Returns [code]true[/code] when the specified [code]line[/code] has a breakpoint.
Returns [code]true[/code] when the specified [code]line[/code] is marked as safe.
Returns [code]true[/code] if the selection is active.
Triggers a right-click menu action by the specified index. See [enum MenuItems] for a list of available indexes.
Paste the current selection.
Perform redo operation.
Removes all the breakpoints. This will not fire the [signal breakpoint_toggled] signal.
Perform a search inside the text. Search flags can be specified in the [enum SearchFlags] enum.
Returns an empty [code]PoolIntArray[/code] if no result was found. Otherwise, the result line and column can be accessed at indices specified in the [enum SearchResult] enum, e.g:
[codeblock]
var result = search(key, flags, line, column)
if result.size() > 0:
# Result found.
var res_line = result[TextEdit.SEARCH_RESULT_LINE]
var res_column = result[TextEdit.SEARCH_RESULT_COLUMN]
[/codeblock]
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.
Sets the text for a specific line.
Bookmarks the [code]line[/code] if [code]bookmark[/code] is true. Deletes the bookmark if [code]bookmark[/code] is false.
Bookmarks are shown in the [member breakpoint_gutter].
Adds or removes the breakpoint in [code]line[/code]. Breakpoints are shown in the [member breakpoint_gutter].
If [code]true[/code], hides the line of the specified index.
If [code]true[/code], marks the [code]line[/code] as safe.
This will show the line number with the color provided in the [code]safe_line_number_color[/code] theme property.
Toggle the folding of the code block at the given line.
Perform undo operation.
Unfolds the given line, if folded.
Unhide all lines that were previously set to hidden by [method set_line_as_hidden].
If [code]true[/code], the breakpoint gutter is visible.
If [code]true[/code], the caret (visual cursor) blinks.
Duration (in seconds) of a caret's blinking cycle.
If [code]true[/code], the caret displays as a rectangle.
If [code]false[/code], the caret displays as a bar.
If [code]true[/code], a right-click moves the cursor at the mouse position before displaying the context menu.
If [code]false[/code], the context menu disregards mouse location.
If [code]true[/code], a right-click displays the context menu.
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], the fold gutter is visible. This enables folding groups of indented lines.
If [code]true[/code], all lines that have been set to hidden by [method set_line_as_hidden], will not be visible.
If [code]true[/code], all occurrences of the selected text will be highlighted.
If [code]true[/code], the line containing the cursor is highlighted.
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_color_selected[/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], line numbers are displayed to the left of the text.
If [code]true[/code], sets the [code]step[/code] of the scrollbars to [code]0.25[/code] which results in smoother scrolling.
If [code]true[/code], any custom color properties that have been set for this [TextEdit] will be visible.
String value of the [TextEdit].
Vertical scroll sensitivity.
If [code]true[/code], the native virtual keyboard is shown when focused on platforms that support it.
If [code]true[/code], enables text wrapping when it goes beyond the edge of what is visible.
Emitted when a breakpoint is placed via the breakpoint gutter.
Emitted when the cursor changes.
Emitted when the info icon is clicked.
Emitted when the text changes.
Match case when searching.
Match whole words when searching.
Search from end to beginning.
Used to access the result column from [method search].
Used to access the result line from [method search].
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.
Represents the size of the [enum MenuItems] enum.
Sets the background [Color] of this [TextEdit]. [member syntax_highlighting] has to be enabled.
Sets the [Color] of the bookmark marker. [member syntax_highlighting] has to be enabled.
Sets the [Color] of the breakpoints. [member breakpoint_gutter] has to be enabled.
Sets the [Color] of the breakpoints. [member breakpoint_gutter] has to be enabled.
Sets the default [Font].
Sets the font [Color].
Sets the [Color] of the selected text. [member override_selected_font_color] has to be enabled.
Sets the [Color] of the line numbers. [member show_line_numbers] has to be enabled.
Sets the spacing between the lines.
Sets the [Color] of marked text.
Sets the [StyleBox] of this [TextEdit].
Sets the [StyleBox] of this [TextEdit] when [member readonly] is enabled.
Sets the highlight [Color] of text selections.
Sets a custom [Texture] for tab text characters.
Sets the highlight [Color] of multiple occurrences. [member highlight_all_occurrences] has to be enabled.