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.
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 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 text of a specific line.
Returns the line and column at the given position. In the returned vector, [code]x[/code] is the column, [code]y[/code] is the line.
Returns the amount of total lines in the text.
Returns the height of a largest line.
Returns the width in pixels of the [code]wrap_index[/code] on [code]line[/code].
Returns the number of times the given line is wrapped.
Returns an array of [String]s representing each wrapped index.
Returns the [PopupMenu] of this [TextEdit]. By default, this menu is displayed when right-clicking on the [TextEdit].
[b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property.
Returns the local position for the given [code]line[/code] and [code]column[/code]. If [code]x[/code] or [code]y[/code] of the returned vector equal [code]-1[/code], the position is outside of the viewable area of the control.
[b]Note:[/b] The Y position corresponds to the bottom side of the line. Use [method get_rect_at_line_column] to get the top side position.
Returns the local position and size for the grapheme at the given [code]line[/code] and [code]column[/code]. If [code]x[/code] or [code]y[/code] position of the returned rect equal [code]-1[/code], the position is outside of the viewable area of the control.
[b]Note:[/b] The Y position of the returned rect corresponds to the top side of the line, unlike [method get_pos_at_line_column] which returns the bottom side.
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 total width of all gutters and internal padding.
Returns the total amount of lines that could be drawn.
Returns the number of visible lines, including wrapped text.
Returns a [String] text with the word under the caret (text cursor) location.
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 if the given line is wrapped.
Returns whether the mouse is over selection. If [code]edges[/code] is [code]true[/code], the edges are considered part of the selection.
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 bookmark gutter is visible.
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 selected text will be deselected when focus is lost.
If [code]true[/code], allow drag and drop of selected text.
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.
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 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 [Color] of marked text.
Sets the highlight [Color] of text selections.
Sets the highlight [Color] of multiple occurrences. [member highlight_all_occurrences] has to be enabled.
Sets the spacing between the lines.
Sets the default [Font].
Sets a custom [Texture] for tab text characters.
Sets the [StyleBox] of this [TextEdit].
Sets the [StyleBox] of this [TextEdit] when [member readonly] is enabled.