Index · Object → Node → CanvasItem → Control → TextEdit

TextEdit

A multiline text editor.

Inherited by (1): CodeEdit
Class Description

A multiline text editor. It also has limited facilities for editing code, such as syntax highlighting support. For more advanced facilities for editing code, see CodeEdit.

While entering text, it is possible to insert special characters using Unicode, OEM or Windows alt codes:

- To enter Unicode codepoints, hold Alt and type the codepoint on the numpad. For example, to enter the character á (U+00E1), hold Alt and type +E1 on the numpad (the leading zeroes can be omitted).

- To enter OEM codepoints, hold Alt and type the code on the numpad. For example, to enter the character á (OEM 160), hold Alt and type 160 on the numpad.

- To enter Windows codepoints, hold Alt and type the code on the numpad. For example, to enter the character á (Windows 0225), hold Alt and type 0, 2, 2, 5 on the numpad. The leading zero here must not be omitted, as this is how Windows codepoints are distinguished from OEM codepoints.

Note: Most viewport, caret, and edit methods contain a caret_index argument for caret_multiple support. The argument should be one of the following: -1 for all carets, 0 for the main caret, or greater than 0 for secondary carets in the order they were created.

Note: When holding down Alt, the vertical scroll wheel will scroll 5 times as fast as it would normally do. This also works in the Godot script editor.

Properties

var autowrap_mode: TextServer.AutowrapMode = 3

If wrap_mode is set to LINE_WRAPPING_BOUNDARY, sets text wrapping mode.

var backspace_deletes_composite_character_enabled: bool = false

If true and caret_mid_grapheme is false, backspace deletes an entire composite character such as ❤️‍🩹, instead of deleting part of the composite character.

var caret_draw_when_editable_disabled: bool = false

If true, caret will be visible when editable is disabled.

var caret_mid_grapheme: bool = false

Allow moving caret, selecting and removing the individual composite character components.

Note: Backspace is always removing individual composite character components.

var caret_move_on_right_click: bool = true

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

If false, the context menu ignores mouse location.

var caret_multiple: bool = true

If true, multiple carets are allowed. Left-clicking with Alt adds a new caret. See add_caret() and get_caret_count().

var caret_type: TextEdit.CaretType = 0

Set the type of caret to draw.

var context_menu_enabled: bool = true

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

var custom_word_separators: String = ""

The characters to consider as word delimiters if use_custom_word_separators is true. The characters should be defined without separation, for example #_!.

var deselect_on_focus_loss_enabled: bool = true

If true, the selected text will be deselected when focus is lost.

var drag_and_drop_selection_enabled: bool = true

If true, allow drag and drop of selected text. Text can still be dropped from other sources.

var draw_control_chars: bool = false

If true, control characters are displayed.

var draw_spaces: bool = false

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

var draw_tabs: bool = false

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

var editable: bool = true

If false, existing text cannot be modified and new text cannot be added.

var emoji_menu_enabled: bool = true

If true, "Emoji and Symbols" menu is enabled.

var empty_selection_clipboard_enabled: bool = true

If true, copying or cutting without a selection is performed on all lines with a caret. Otherwise, copy and cut require a selection.

var focus_mode: Control.FocusMode = 2
var highlight_all_occurrences: bool = false

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

var highlight_current_line: bool = false

If true, the line containing the cursor is highlighted.

var indent_wrapped_lines: bool = false

If true, all wrapped lines are indented to the same amount as the unwrapped line.

var language: String = ""

Language code used for line-breaking and text shaping algorithms. If left empty, the current locale is used instead.

var middle_mouse_paste_enabled: bool = true

If false, using middle mouse button to paste clipboard will be disabled.

Note: This method is only implemented on Linux.

var minimap_draw: bool = false

If true, a minimap is shown, providing an outline of your source code. The minimap uses a fixed-width text size.

var minimap_width: int = 80

The width, in pixels, of the minimap.

var mouse_default_cursor_shape: Control.CursorShape = 1
var placeholder_text: String = ""

Text shown when the TextEdit is empty. It is not the TextEdit's default value (see text).

var scroll_fit_content_height: bool = false

If true, TextEdit fits its minimum height to the number of visible lines instead of scrolling vertically. If a maximum height is set (for example via Control.custom_maximum_size) and content exceeds it, a vertical scrollbar is shown.

var scroll_fit_content_width: bool = false

If true, TextEdit fits its minimum width to the widest line instead of scrolling horizontally. If a maximum width is set (for example via Control.custom_maximum_size) and content exceeds it, a horizontal scrollbar is shown.

var scroll_horizontal: int = 0

If there is a horizontal scrollbar, this determines the current horizontal scroll value in pixels.

var scroll_past_end_of_file: bool = false

Allow scrolling past the last line into "virtual" space.

var scroll_smooth: bool = false

Scroll smoothly over the text rather than jumping to the next location.

var scroll_v_scroll_speed: float = 80.0

Sets the scroll speed with the minimap or when scroll_smooth is enabled.

var scroll_vertical: float = 0.0

If there is a vertical scrollbar, this determines the current vertical scroll value in line numbers, starting at 0 for the top line.

var selecting_enabled: bool = true

If true, text can be selected.

If false, text can not be selected by the user or by the select() or select_all() methods.

var shortcut_keys_enabled: bool = true

If true, shortcut keys for context menu items are enabled, even if the context menu is disabled.

var structured_text_bidi_override: TextServer.StructuredTextParser = 0

Set BiDi algorithm override for the structured text.

var structured_text_bidi_override_options: Array = []

Set additional options for BiDi override.

var syntax_highlighter: SyntaxHighlighter

The syntax highlighter to use.

Note: A SyntaxHighlighter instance should not be used across multiple TextEdit nodes.

var tab_input_mode: bool = true

If true, ProjectSettings.input/ui_text_indent input Tab character, otherwise it moves keyboard focus to the next Control in the scene.

var text: String = ""

String value of the TextEdit.

var text_direction: Control.TextDirection = 0

Base text writing direction.

var use_custom_word_separators: bool = false

If false, using Ctrl + Left or Ctrl + Right (Cmd + Left or Cmd + Right on macOS) bindings will use the behavior of use_default_word_separators. If true, it will also stop the caret if a character within custom_word_separators is detected. Useful for subword moving. This behavior also will be applied to the behavior of text selection.

var use_default_word_separators: bool = true

If false, using Ctrl + Left or Ctrl + Right (Cmd + Left or Cmd + Right on macOS) bindings will stop moving caret only if a space or punctuation is detected. If true, it will also stop the caret if a character is part of !"#$%&'()*+,-./:;<=>?@[\]^`{|}~, the Unicode General Punctuation table, or the Unicode CJK Punctuation table. Useful for subword moving. This behavior also will be applied to the behavior of text selection.

var virtual_keyboard_enabled: bool = true

If true, the native virtual keyboard is enabled on platforms that support it.

var virtual_keyboard_show_on_focus: bool = true

If true, the native virtual keyboard is shown on focus events on platforms that support it.

var wrap_mode: TextEdit.LineWrappingMode = 0

Sets the line wrapping mode to use.

Inherited from Control (62)
var accessibility_controls_nodes: NodePath[] = []
var accessibility_flow_to_nodes: NodePath[] = []
var accessibility_labeled_by_nodes: NodePath[] = []
var anchor_bottom: float = 0.0
var anchor_left: float = 0.0
var anchor_right: float = 0.0
var anchor_top: float = 0.0
var clip_contents: bool = false
var custom_maximum_size: Vector2 = Vector2(-1, -1)
var custom_minimum_size: Vector2 = Vector2(0, 0)
var focus_neighbor_bottom: NodePath = NodePath("")
var focus_neighbor_left: NodePath = NodePath("")
var focus_neighbor_right: NodePath = NodePath("")
var focus_neighbor_top: NodePath = NodePath("")
var focus_next: NodePath = NodePath("")
var focus_previous: NodePath = NodePath("")
var offset_bottom: float = 0.0
var offset_left: float = 0.0
var offset_right: float = 0.0
var offset_top: float = 0.0
var offset_transform_pivot: Vector2 = Vector2(0, 0)
var offset_transform_pivot_ratio: Vector2 = Vector2(0.5, 0.5)
var offset_transform_position: Vector2 = Vector2(0, 0)
var offset_transform_scale: Vector2 = Vector2(1, 1)
var pivot_offset: Vector2 = Vector2(0, 0)
var pivot_offset_ratio: Vector2 = Vector2(0, 0)
var position: Vector2 = Vector2(0, 0)
var rotation: float = 0.0
var scale: Vector2 = Vector2(1, 1)
var size: Vector2 = Vector2(0, 0)
Inherited from CanvasItem (16)
var light_mask: int = 1
var modulate: Color = Color(1, 1, 1, 1)
var self_modulate: Color = Color(1, 1, 1, 1)
var top_level: bool = false
var visible: bool = true
var y_sort_enabled: bool = false
var z_as_relative: bool = true
var z_index: int = 0
Inherited from Node (14)
var owner: Node

Methods

func _backspace(caret_index: int) -> void

Override this method to define what happens when the user presses the backspace key.

func _copy(caret_index: int) -> void

Override this method to define what happens when the user performs a copy operation.

func _cut(caret_index: int) -> void

Override this method to define what happens when the user performs a cut operation.

func _handle_unicode_input(unicode_char: int, caret_index: int) -> void

Override this method to define what happens when the user types in the provided key unicode_char.

func _paste(caret_index: int) -> void

Override this method to define what happens when the user performs a paste operation.

func _paste_primary_clipboard(caret_index: int) -> void

Override this method to define what happens when the user performs a paste operation with middle mouse button.

Note: This method is only implemented on Linux.

func add_caret(line: int, column: int) -> int

Adds a new caret at the given location. Returns the index of the new caret, or -1 if the location is invalid.

func add_caret_at_carets(below: bool) -> void

Adds an additional caret above or below every caret. If below is true the new caret will be added below and above otherwise.

func add_gutter(at: int = -1) -> void

Register a new gutter to this TextEdit. Use at to have a specific gutter order. A value of -1 appends the gutter to the right.

func add_selection_for_next_occurrence() -> void

Adds a selection and a caret for the next occurrence of the current selection. If there is no active selection, selects word under caret.

func adjust_carets_after_edit(caret: int, from_line: int, from_col: int, to_line: int, to_col: int) -> void

This method does nothing.

func adjust_viewport_to_caret(caret_index: int = 0) -> void

Adjust the viewport so the caret is visible.

func apply_ime() -> void

Applies text from the Input Method Editor (IME) to each caret and closes the IME if it is open.

func backspace(caret_index: int = -1) -> void

Called when the user presses the backspace key. Can be overridden with _backspace().

func begin_complex_operation() -> void

Starts a multipart edit. All edits will be treated as one action until end_complex_operation() is called.

func begin_multicaret_edit() -> void

Starts an edit for multiple carets. The edit must be ended with end_multicaret_edit(). Multicaret edits can be used to edit text at multiple carets and delay merging the carets until the end, so the caret indexes aren't affected immediately. begin_multicaret_edit() and end_multicaret_edit() can be nested, and the merge will happen at the last end_multicaret_edit().

begin_complex_operation()
begin_multicaret_edit()
for i in range(get_caret_count()):
	if multicaret_edit_ignore_caret(i):
		continue
	# Logic here.
end_multicaret_edit()
end_complex_operation()
func cancel_ime() -> void

Closes the Input Method Editor (IME) if it is open. Any text in the IME will be lost.

func center_viewport_to_caret(caret_index: int = 0) -> void

Centers the viewport on the line the editing caret is at. This also resets the scroll_horizontal value to 0.

func clear() -> void

Performs a full reset of TextEdit, including undo history.

func clear_undo_history() -> void

Clears the undo history.

func collapse_carets(from_line: int, from_column: int, to_line: int, to_column: int, inclusive: bool = false) -> void

Collapse all carets in the given range to the from_line and from_column position.

inclusive applies to both ends.

If is_in_mulitcaret_edit() is true, carets that are collapsed will be true for multicaret_edit_ignore_caret().

merge_overlapping_carets() will be called if any carets were collapsed.

func copy(caret_index: int = -1) -> void

Copies the current text selection. Can be overridden with _copy().

func cut(caret_index: int = -1) -> void

Cut's the current selection. Can be overridden with _cut().

func delete_selection(caret_index: int = -1) -> void

Deletes the selected text.

func deselect(caret_index: int = -1) -> void

Deselects the current selection.

func end_action() -> void

Marks the end of steps in the current action started with start_action().

func end_complex_operation() -> void

Ends a multipart edit, started with begin_complex_operation(). If called outside a complex operation, the current operation is pushed onto the undo/redo stack.

func end_multicaret_edit() -> void

Ends an edit for multiple carets, that was started with begin_multicaret_edit(). If this was the last end_multicaret_edit() and merge_overlapping_carets() was called, carets will be merged.

func get_caret_column(caret_index: int = 0) -> int

Returns the column the editing caret is at.

func get_caret_count() -> int

Returns the number of carets in this TextEdit.

func get_caret_draw_pos(caret_index: int = 0) -> Vector2

Returns the caret pixel draw position.

func get_caret_index_edit_order() -> PackedInt32Array

Returns a list of caret indexes in their edit order, this done from bottom to top. Edit order refers to the way actions such as insert_text_at_caret() are applied.

func get_caret_line(caret_index: int = 0) -> int

Returns the line the editing caret is on.

func get_caret_wrap_index(caret_index: int = 0) -> int

Returns the wrap index the editing caret is on.

func get_first_non_whitespace_column(line: int) -> int

Returns the first column containing a non-whitespace character on the given line. If there is only whitespace, returns the number of characters.

func get_first_visible_line() -> int

Returns the first visible line.

func get_gutter_count() -> int

Returns the number of gutters registered.

func get_gutter_name(gutter: int) -> String

Returns the name of the gutter at the given index.

func get_gutter_type(gutter: int) -> TextEdit.GutterType

Returns the type of the gutter at the given index. Gutters can contain icons, text, or custom visuals.

func get_gutter_width(gutter: int) -> int

Returns the width of the gutter at the given index.

func get_h_scroll_bar() -> HScrollBar

Returns the HScrollBar used by TextEdit.

func get_indent_level(line: int) -> int

Returns the indent level of the given line. This is the number of spaces and tabs at the beginning of the line, with the tabs taking the tab size into account (see get_tab_size()).

func get_last_full_visible_line() -> int

Returns the last visible line. Use get_last_full_visible_line_wrap_index() for the wrap index.

func get_last_full_visible_line_wrap_index() -> int

Returns the last visible wrap index of the last visible line.

func get_last_unhidden_line() -> int

Returns the last unhidden line in the entire TextEdit.

func get_line(line: int) -> String

Returns the text of a specific line.

func get_line_background_color(line: int) -> Color

Returns the custom background color of the given line. If no color is set, returns Color(0, 0, 0, 0).

func get_line_column_at_pos(position: Vector2i, clamp_line: bool = true, clamp_column: bool = true) -> Vector2i

Returns the line and column at the given position. In the returned vector, x is the column and y is the line.

If clamp_line is false and position is below the last line, Vector2i(-1, -1) is returned.

If clamp_column is false and position is outside the column range of the line, Vector2i(-1, -1) is returned.

func get_line_count() -> int

Returns the number of lines in the text.

func get_line_gutter_icon(line: int, gutter: int) -> Texture2D

Returns the icon currently in gutter at line. This only works when the gutter type is GUTTER_TYPE_ICON (see set_gutter_type()).

func get_line_gutter_item_color(line: int, gutter: int) -> Color

Returns the color currently in gutter at line.

func get_line_gutter_metadata(line: int, gutter: int) -> Variant

Returns the metadata currently in gutter at line.

func get_line_gutter_text(line: int, gutter: int) -> String

Returns the text currently in gutter at line. This only works when the gutter type is GUTTER_TYPE_STRING (see set_gutter_type()).

func get_line_height() -> int

Returns the maximum value of the line height among all lines.

Note: The return value is influenced by line_spacing and font_size. And it will not be less than 1.

func get_line_ranges_from_carets(only_selections: bool = false, merge_adjacent: bool = true) -> Vector2i[]

Returns an Array of line ranges where x is the first line and y is the last line. All lines within these ranges will have a caret on them or be part of a selection. Each line will only be part of one line range, even if it has multiple carets on it.

If a selection's end column (get_selection_to_column()) is at column 0, that line will not be included. If a selection begins on the line after another selection ends and merge_adjacent is true, or they begin and end on the same line, one line range will include both selections.

func get_line_width(line: int, wrap_index: int = -1) -> int

Returns the width in pixels of the wrap_index on line.

func get_line_with_ime(line: int) -> String

Returns line text as it is currently displayed, including IME composition string.

func get_line_wrap_count(line: int) -> int

Returns the number of times the given line is wrapped.

func get_line_wrap_index_at_column(line: int, column: int) -> int

Returns the wrap index of the given column on the given line. This ranges from 0 to get_line_wrap_count().

func get_line_wrapped_text(line: int) -> PackedStringArray

Returns an array of Strings representing each wrapped index.

func get_local_mouse_pos() -> Vector2

Returns the local mouse position adjusted for the text direction.

func get_menu() -> PopupMenu

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

You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see MenuItems). For example:

func _ready():
	var menu = get_menu()
	# Remove all items after "Redo".
	menu.item_count = menu.get_item_index(MENU_REDO) + 1
	# Add custom items.
	menu.add_separator()
	menu.add_item("Insert Date", MENU_MAX + 1)
	# Connect callback.
	menu.id_pressed.connect(_on_item_pressed)

func _on_item_pressed(id):
	if id == MENU_MAX + 1:
		insert_text_at_caret(Time.get_date_string_from_system())

Warning: 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 Window.visible property.

func get_minimap_line_at_pos(position: Vector2i) -> int

Returns the equivalent minimap line at position.

func get_minimap_visible_lines() -> int

Returns the number of lines that may be drawn on the minimap.

func get_next_composite_character_column(line: int, column: int) -> int

Returns the correct column at the end of a composite character like ❤️‍🩹 (mending heart; Unicode: U+2764 U+FE0F U+200D U+1FA79) which is comprised of more than one Unicode code point, if the caret is at the start of the composite character. Also returns the correct column with the caret at mid grapheme and for non-composite characters.

Note: To check at caret location use get_next_composite_character_column(get_caret_line(), get_caret_column())

func get_next_visible_line_index_offset_from(line: int, wrap_index: int, visible_amount: int) -> Vector2i

Similar to get_next_visible_line_offset_from(), but takes into account the line wrap indexes. In the returned vector, x is the line, y is the wrap index.

func get_next_visible_line_offset_from(line: int, visible_amount: int) -> int

Returns the count to the next visible line from line to line + visible_amount. Can also count backwards. For example if a TextEdit has 5 lines with lines 2 and 3 hidden, calling this with line = 1, visible_amount = 1 would return 3.

func get_pos_at_line_column(line: int, column: int) -> Vector2i

Returns the local position for the given line and column. If x or y of the returned vector equal -1, the position is outside of the viewable area of the control.

Note: The Y position corresponds to the bottom side of the line. Use get_rect_at_line_column() to get the top side position.

func get_previous_composite_character_column(line: int, column: int) -> int

Returns the correct column at the start of a composite character like ❤️‍🩹 (mending heart; Unicode: U+2764 U+FE0F U+200D U+1FA79) which is comprised of more than one Unicode code point, if the caret is at the end of the composite character. Also returns the correct column with the caret at mid grapheme and for non-composite characters.

Note: To check at caret location use get_previous_composite_character_column(get_caret_line(), get_caret_column())

func get_rect_at_line_column(line: int, column: int) -> Rect2i

Returns the local position and size for the grapheme at the given line and column. If x or y position of the returned rect equal -1, the position is outside of the viewable area of the control.

Note: The Y position of the returned rect corresponds to the top side of the line, unlike get_pos_at_line_column() which returns the bottom side.

func get_saved_version() -> int

Returns the last tagged saved version from tag_saved_version().

func get_scroll_pos_for_line(line: int, wrap_index: int = 0) -> float

Returns the scroll position for wrap_index of line.

func get_selected_text(caret_index: int = -1) -> String

Returns the text inside the selection of a caret, or all the carets if caret_index is its default value -1.

func get_selection_at_line_column(line: int, column: int, include_edges: bool = true, only_selections: bool = true) -> int

Returns the caret index of the selection at the given line and column, or -1 if there is none.

If include_edges is false, the position must be inside the selection and not at either end. If only_selections is false, carets without a selection will also be considered.

func get_selection_column(caret_index: int = 0) -> int

Returns the original start column of the selection.

func get_selection_from_column(caret_index: int = 0) -> int

Returns the selection begin column. Returns the caret column if there is no selection.

func get_selection_from_line(caret_index: int = 0) -> int

Returns the selection begin line. Returns the caret line if there is no selection.

func get_selection_line(caret_index: int = 0) -> int

Returns the original start line of the selection.

func get_selection_mode() -> TextEdit.SelectionMode

Returns the current selection mode.

func get_selection_origin_column(caret_index: int = 0) -> int

Returns the origin column of the selection. This is the opposite end from the caret.

func get_selection_origin_line(caret_index: int = 0) -> int

Returns the origin line of the selection. This is the opposite end from the caret.

func get_selection_to_column(caret_index: int = 0) -> int

Returns the selection end column. Returns the caret column if there is no selection.

func get_selection_to_line(caret_index: int = 0) -> int

Returns the selection end line. Returns the caret line if there is no selection.

func get_sorted_carets(include_ignored_carets: bool = false) -> PackedInt32Array

Returns the carets sorted by selection beginning from lowest line and column to highest (from top to bottom of text).

If include_ignored_carets is false, carets from multicaret_edit_ignore_caret() will be ignored.

func get_tab_size() -> int

Returns the TextEdit's' tab size.

func get_total_gutter_width() -> int

Returns the total width of all gutters and internal padding.

func get_total_visible_line_count() -> int

Returns the total number of lines in the text. This includes wrapped lines and excludes folded lines. If wrap_mode is set to LINE_WRAPPING_NONE and no lines are folded (see CodeEdit.is_line_folded()) then this is equivalent to get_line_count(). See get_visible_line_count_in_range() for a limited range of lines.

func get_v_scroll_bar() -> VScrollBar

Returns the VScrollBar of the TextEdit.

func get_version() -> int

Returns the current version of the TextEdit. The version is a count of recorded operations by the undo/redo history.

func get_visible_line_count() -> int

Returns the number of lines that can visually fit, rounded down, based on this control's height.

func get_visible_line_count_in_range(from_line: int, to_line: int) -> int

Returns the total number of lines between from_line and to_line (inclusive) in the text. This includes wrapped lines and excludes folded lines. If the range covers all lines it is equivalent to get_total_visible_line_count().

func get_word_at_pos(position: Vector2) -> String

Returns the word at position.

func get_word_under_caret(caret_index: int = -1) -> String

Returns a String text with the word under the caret's location.

func has_ime_text() -> bool

Returns true if the user has text in the Input Method Editor (IME).

func has_redo() -> bool

Returns true if a "redo" action is available.

func has_selection(caret_index: int = -1) -> bool

Returns true if the user has selected text.

func has_undo() -> bool

Returns true if an "undo" action is available.

func insert_line_at(line: int, text: String) -> void

Inserts a new line with text at line.

func insert_text(text: String, line: int, column: int, before_selection_begin: bool = true, before_selection_end: bool = false) -> void

Inserts the text at line and column.

If before_selection_begin is true, carets and selections that begin at line and column will moved to the end of the inserted text, along with all carets after it.

If before_selection_end is true, selections that end at line and column will be extended to the end of the inserted text. These parameters can be used to insert text inside of or outside of selections.

func insert_text_at_caret(text: String, caret_index: int = -1) -> void

Insert the specified text at the caret position.

func is_caret_after_selection_origin(caret_index: int = 0) -> bool

Returns true if the caret of the selection is after the selection origin. This can be used to determine the direction of the selection.

func is_caret_visible(caret_index: int = 0) -> bool

Returns true if the caret is visible, false otherwise. A caret will be considered hidden if it is outside the scrollable area when scrolling is enabled.

Note: is_caret_visible() does not account for a caret being off-screen if it is still within the scrollable area. It will return true even if the caret is off-screen as long as it meets TextEdit's own conditions for being visible. This includes uses of scroll_fit_content_width and scroll_fit_content_height that cause the TextEdit to expand beyond the viewport's bounds.

Note: This method does not guarantee an accurate visibility check immediately after setting the caret position. The correct value may only be available in the next frame after the TextEdit has finished drawing. This also applies to any operation that causes the TextEdit to change in size.

func is_dragging_cursor() -> bool

Returns true if the user is dragging their mouse for scrolling, selecting, or text dragging.

func is_gutter_clickable(gutter: int) -> bool

Returns true if the gutter at the given index is clickable. See set_gutter_clickable().

func is_gutter_drawn(gutter: int) -> bool

Returns true if the gutter at the given index is currently drawn. See set_gutter_draw().

func is_gutter_overwritable(gutter: int) -> bool

Returns true if the gutter at the given index is overwritable. See set_gutter_overwritable().

func is_in_mulitcaret_edit() -> bool

Returns true if a begin_multicaret_edit() has been called and end_multicaret_edit() has not yet been called.

func is_line_gutter_clickable(line: int, gutter: int) -> bool

Returns true if the gutter at the given index on the given line is clickable. See set_line_gutter_clickable().

func is_line_in_viewport(line: int) -> bool

Returns true if the given line is within the scope of the scrollable area of the viewport.

func is_line_wrapped(line: int) -> bool

Returns if the given line is wrapped.

func is_menu_visible() -> bool

Returns true if the menu is visible. Use this instead of get_menu().visible to improve performance (so the creation of the menu is avoided). See get_menu().

func is_mouse_over_selection(edges: bool, caret_index: int = -1) -> bool

Returns true if the mouse is over a selection. If edges is true, the edges are considered part of the selection.

func is_overtype_mode_enabled() -> bool

Returns true if overtype mode is enabled. See set_overtype_mode_enabled().

func menu_option(option: int) -> void

Executes a given action as defined in the MenuItems enum.

func merge_gutters(from_line: int, to_line: int) -> void

Merge the gutters from from_line into to_line. Only overwritable gutters will be copied. See set_gutter_overwritable().

func merge_overlapping_carets() -> void

Merges any overlapping carets. Will favor the newest caret, or the caret with a selection.

If is_in_mulitcaret_edit() is true, the merge will be queued to happen at the end of the multicaret edit. See begin_multicaret_edit() and end_multicaret_edit().

Note: This is not called when a caret changes position but after certain actions, so it is possible to get into a state where carets overlap.

func multicaret_edit_ignore_caret(caret_index: int) -> bool

Returns true if the given caret_index should be ignored as part of a multicaret edit. See begin_multicaret_edit() and end_multicaret_edit(). Carets that should be ignored are ones that were part of removed text and will likely be merged at the end of the edit, or carets that were added during the edit.

It is recommended to continue within a loop iterating on multiple carets if a caret should be ignored.

func paste(caret_index: int = -1) -> void

Paste at the current location. Can be overridden with _paste().

func paste_primary_clipboard(caret_index: int = -1) -> void

Pastes the primary clipboard.

func redo() -> void

Perform redo operation.

func remove_caret(caret: int) -> void

Removes the given caret index.

Note: This can result in adjustment of all other caret indices.

func remove_gutter(gutter: int) -> void

Removes the gutter at the given index.

func remove_line_at(line: int, move_carets_down: bool = true) -> void

Removes the line of text at line. Carets on this line will attempt to match their previous visual x position.

If move_carets_down is true carets will move to the next line down, otherwise carets will move up.

func remove_secondary_carets() -> void

Removes all additional carets.

func remove_text(from_line: int, from_column: int, to_line: int, to_column: int) -> void

Removes text between the given positions.

func select(origin_line: int, origin_column: int, caret_line: int, caret_column: int, caret_index: int = 0) -> void

Selects text from origin_line and origin_column to caret_line and caret_column for the given caret_index. This moves the selection origin and the caret. If the positions are the same, the selection will be deselected.

If selecting_enabled is false, no selection will occur.

Note: If supporting multiple carets this will not check for any overlap. See merge_overlapping_carets().

func select_all() -> void

Select all the text.

If selecting_enabled is false, no selection will occur.

func select_word_under_caret(caret_index: int = -1) -> void

Selects the word under the caret.

func set_caret_column(column: int, adjust_viewport: bool = true, caret_index: int = 0) -> void

Moves the caret to the specified column index.

If adjust_viewport is true, the viewport will center at the caret position after the move occurs.

Note: If supporting multiple carets this will not check for any overlap. See merge_overlapping_carets().

func set_caret_line(line: int, adjust_viewport: bool = true, can_be_hidden: bool = true, wrap_index: int = 0, caret_index: int = 0) -> void

Moves the caret to the specified line index. The caret column will be moved to the same visual position it was at the last time set_caret_column() was called, or clamped to the end of the line.

If adjust_viewport is true, the viewport will center at the caret position after the move occurs.

If can_be_hidden is true, the specified line can be hidden.

If wrap_index is -1, the caret column will be clamped to the line's length. If wrap_index is greater than -1, the column will be moved to attempt to match the visual x position on the line's wrap_index to the position from the last time set_caret_column() was called.

Note: If supporting multiple carets this will not check for any overlap. See merge_overlapping_carets().

func set_gutter_clickable(gutter: int, clickable: bool) -> void

If true, the mouse cursor will change to a pointing hand (Control.CURSOR_POINTING_HAND) when hovering over the gutter at the given index. See is_gutter_clickable() and set_line_gutter_clickable().

func set_gutter_custom_draw(column: int, draw_callback: Callable) -> void

Set a custom draw callback for the gutter at the given index. draw_callback must take the following arguments: A line index int, a gutter index int, and an area Rect2. This callback only works when the gutter type is GUTTER_TYPE_CUSTOM (see set_gutter_type()).

func set_gutter_draw(gutter: int, draw: bool) -> void

If true, the gutter at the given index is drawn. The gutter type (set_gutter_type()) determines how it is drawn. See is_gutter_drawn().

func set_gutter_name(gutter: int, name: String) -> void

Sets the name of the gutter at the given index.

func set_gutter_overwritable(gutter: int, overwritable: bool) -> void

If true, the line data of the gutter at the given index can be overridden when using merge_gutters(). See is_gutter_overwritable().

func set_gutter_type(gutter: int, type: TextEdit.GutterType) -> void

Sets the type of gutter at the given index. Gutters can contain icons, text, or custom visuals.

func set_gutter_width(gutter: int, width: int) -> void

Set the width of the gutter at the given index.

func set_line(line: int, new_text: String) -> void

Sets the text for a specific line.

Carets on the line will attempt to keep their visual x position.

func set_line_as_center_visible(line: int, wrap_index: int = 0) -> void

Positions the wrap_index of line at the center of the viewport.

func set_line_as_first_visible(line: int, wrap_index: int = 0) -> void

Positions the wrap_index of line at the top of the viewport.

func set_line_as_last_visible(line: int, wrap_index: int = 0) -> void

Positions the wrap_index of line at the bottom of the viewport.

func set_line_background_color(line: int, color: Color) -> void

Sets the custom background color of the given line. If transparent, this color is applied on top of the default background color (See background_color). If set to Color(0, 0, 0, 0), no additional color is applied.

func set_line_gutter_clickable(line: int, gutter: int, clickable: bool) -> void

If clickable is true, makes the gutter on the given line clickable. This is like set_gutter_clickable(), but for a single line. If is_gutter_clickable() is true, this will not have any effect. See is_line_gutter_clickable() and gutter_clicked.

func set_line_gutter_icon(line: int, gutter: int, icon: Texture2D) -> void

Sets the icon for gutter on line to icon. This only works when the gutter type is GUTTER_TYPE_ICON (see set_gutter_type()).

func set_line_gutter_item_color(line: int, gutter: int, color: Color) -> void

Sets the color for gutter on line to color.

func set_line_gutter_metadata(line: int, gutter: int, metadata: Variant) -> void

Sets the metadata for gutter on line to metadata.

func set_line_gutter_text(line: int, gutter: int, text: String) -> void

Sets the text for gutter on line to text. This only works when the gutter type is GUTTER_TYPE_STRING (see set_gutter_type()).

func set_overtype_mode_enabled(enabled: bool) -> void

If true, enables overtype mode. In this mode, typing overrides existing text instead of inserting text. The ProjectSettings.input/ui_text_toggle_insert_mode action toggles overtype mode. See is_overtype_mode_enabled().

func set_search_flags(flags: int) -> void

Sets the search flags. This is used with set_search_text() to highlight occurrences of the searched text. Search flags can be specified from the SearchFlags enum.

func set_search_text(search_text: String) -> void

Sets the search text. See set_search_flags().

func set_selection_mode(mode: TextEdit.SelectionMode) -> void

Sets the current selection mode.

func set_selection_origin_column(column: int, caret_index: int = 0) -> void

Sets the selection origin column to the column for the given caret_index. If the selection origin is moved to the caret position, the selection will deselect.

func set_selection_origin_line(line: int, can_be_hidden: bool = true, wrap_index: int = -1, caret_index: int = 0) -> void

Sets the selection origin line to the line for the given caret_index. If the selection origin is moved to the caret position, the selection will deselect.

If can_be_hidden is false, The line will be set to the nearest unhidden line below or above.

If wrap_index is -1, the selection origin column will be clamped to the line's length. If wrap_index is greater than -1, the column will be moved to attempt to match the visual x position on the line's wrap_index to the position from the last time set_selection_origin_column() or select() was called.

func set_tab_size(size: int) -> void

Sets the tab size for the TextEdit to use.

func set_tooltip_request_func(callback: Callable) -> void

Provide custom tooltip text. The callback method must take the following args: hovered_word: String.

func skip_selection_for_next_occurrence() -> void

Moves a selection and a caret for the next occurrence of the current selection. If there is no active selection, moves to the next occurrence of the word under caret.

func start_action(action: TextEdit.EditAction) -> void

Starts an action, will end the current action if action is different.

An action will also end after a call to end_action(), after ProjectSettings.gui/timers/text_edit_idle_detect_sec is triggered or a new undoable step outside the start_action() and end_action() calls.

func swap_lines(from_line: int, to_line: int) -> void

Swaps the two lines. Carets will be swapped with the lines.

func tag_saved_version() -> void

Tag the current version as saved.

func undo() -> void

Perform undo operation.

Inherited from Control (100)
func _can_drop_data(at_position: Vector2, data: Variant) -> bool
func _drop_data(at_position: Vector2, data: Variant) -> void
func _get_cursor_shape(at_position: Vector2) -> int
func _get_drag_data(at_position: Vector2) -> Variant
func _get_tooltip(at_position: Vector2) -> String
func _gui_input(event: InputEvent) -> void
func _has_point(point: Vector2) -> bool
func _structured_text_parser(args: Array, text: String) -> Vector3i[]
func accept_event() -> void
func accessibility_drag() -> void
func accessibility_drop() -> void
func add_theme_color_override(name: StringName, color: Color) -> void
func add_theme_constant_override(name: StringName, constant: int) -> void
func add_theme_font_override(name: StringName, font: Font) -> void
func add_theme_font_size_override(name: StringName, font_size: int) -> void
func add_theme_icon_override(name: StringName, texture: Texture2D) -> void
func add_theme_stylebox_override(name: StringName, stylebox: StyleBox) -> void
func force_drag(data: Variant, preview: Control) -> void
func get_anchor(side: Side) -> float
func get_begin() -> Vector2
func get_cursor_shape(at_position: Vector2 = Vector2(0, 0)) -> Control.CursorShape
func get_end() -> Vector2
func get_focus_neighbor(side: Side) -> NodePath
func get_offset(offset: Side) -> float
func get_rect() -> Rect2
func get_theme_color(name: StringName, theme_type: StringName = &"") -> Color
func get_theme_constant(name: StringName, theme_type: StringName = &"") -> int
func get_theme_font(name: StringName, theme_type: StringName = &"") -> Font
func get_theme_font_size(name: StringName, theme_type: StringName = &"") -> int
func get_theme_icon(name: StringName, theme_type: StringName = &"") -> Texture2D
func get_theme_stylebox(name: StringName, theme_type: StringName = &"") -> StyleBox
func get_tooltip(at_position: Vector2 = Vector2(0, 0)) -> String
func grab_click_focus() -> void
func grab_focus(hide_focus: bool = false) -> void
func has_focus(ignore_hidden_focus: bool = false) -> bool
func has_theme_color(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_constant(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_font(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_font_size(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_icon(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_stylebox(name: StringName, theme_type: StringName = &"") -> bool
func release_focus() -> void
func reset_size() -> void
func set_anchor(side: Side, anchor: float, keep_offset: bool = false, push_opposite_anchor: bool = true) -> void
func set_anchor_and_offset(side: Side, anchor: float, offset: float, push_opposite_anchor: bool = false) -> void
func set_anchors_and_offsets_preset(preset: Control.LayoutPreset, resize_mode: Control.LayoutPresetMode = 0, margin: int = 0) -> void
func set_anchors_preset(preset: Control.LayoutPreset, keep_offsets: bool = false) -> void
func set_begin(position: Vector2) -> void
func set_drag_forwarding(drag_func: Callable, can_drop_func: Callable, drop_func: Callable) -> void
func set_drag_preview(control: Control) -> void
func set_end(position: Vector2) -> void
func set_focus_neighbor(side: Side, neighbor: NodePath) -> void
func set_global_position(position: Vector2, keep_offsets: bool = false) -> void
func set_offset(side: Side, offset: float) -> void
func set_offsets_preset(preset: Control.LayoutPreset, resize_mode: Control.LayoutPresetMode = 0, margin: int = 0) -> void
func set_position(position: Vector2, keep_offsets: bool = false) -> void
func set_size(size: Vector2, keep_offsets: bool = false) -> void
func update_maximum_size() -> void
func update_minimum_size() -> void
func warp_mouse(position: Vector2) -> void
Inherited from CanvasItem (62)
func _draw() -> void
func draw_animation_slice(animation_length: float, slice_begin: float, slice_end: float, offset: float = 0.0) -> void
func draw_arc(center: Vector2, radius: float, start_angle: float, end_angle: float, point_count: int, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_char(font: Font, pos: Vector2, char: String, font_size: int = 16, modulate: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) -> void
func draw_char_outline(font: Font, pos: Vector2, char: String, font_size: int = 16, size: int = -1, modulate: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) -> void
func draw_circle(position: Vector2, radius: float, color: Color, filled: bool = true, width: float = -1.0, antialiased: bool = false) -> void
func draw_colored_polygon(points: PackedVector2Array, color: Color, uvs: PackedVector2Array = PackedVector2Array(), texture: Texture2D = null) -> void
func draw_dashed_line(from: Vector2, to: Vector2, color: Color, width: float = -1.0, dash: float = 2.0, aligned: bool = true, antialiased: bool = false) -> void
func draw_ellipse(position: Vector2, major: float, minor: float, color: Color, filled: bool = true, width: float = -1.0, antialiased: bool = false) -> void
func draw_ellipse_arc(center: Vector2, major: float, minor: float, start_angle: float, end_angle: float, point_count: int, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_end_animation() -> void
func draw_lcd_texture_rect_region(texture: Texture2D, rect: Rect2, src_rect: Rect2, modulate: Color = Color(1, 1, 1, 1)) -> void
func draw_line(from: Vector2, to: Vector2, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_mesh(mesh: Mesh, texture: Texture2D, transform: Transform2D = Transform2D(1, 0, 0, 1, 0, 0), modulate: Color = Color(1, 1, 1, 1)) -> void
func draw_msdf_texture_rect_region(texture: Texture2D, rect: Rect2, src_rect: Rect2, modulate: Color = Color(1, 1, 1, 1), outline: float = 0.0, pixel_range: float = 4.0, scale: float = 1.0) -> void
func draw_multiline(points: PackedVector2Array, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_multiline_colors(points: PackedVector2Array, colors: PackedColorArray, width: float = -1.0, antialiased: bool = false) -> void
func draw_multiline_string(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, max_lines: int = -1, modulate: Color = Color(1, 1, 1, 1), brk_flags: TextServer.LineBreakFlag = 3, justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_multiline_string_outline(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, max_lines: int = -1, size: int = 1, modulate: Color = Color(1, 1, 1, 1), brk_flags: TextServer.LineBreakFlag = 3, justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_multimesh(multimesh: MultiMesh, texture: Texture2D) -> void
func draw_polygon(points: PackedVector2Array, colors: PackedColorArray, uvs: PackedVector2Array = PackedVector2Array(), texture: Texture2D = null) -> void
func draw_polyline(points: PackedVector2Array, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_polyline_colors(points: PackedVector2Array, colors: PackedColorArray, width: float = -1.0, antialiased: bool = false) -> void
func draw_primitive(points: PackedVector2Array, colors: PackedColorArray, uvs: PackedVector2Array, texture: Texture2D = null) -> void
func draw_rect(rect: Rect2, color: Color, filled: bool = true, width: float = -1.0, antialiased: bool = false) -> void
func draw_set_transform(position: Vector2, rotation: float = 0.0, scale: Vector2 = Vector2(1, 1)) -> void
func draw_string(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, modulate: Color = Color(1, 1, 1, 1), justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_string_outline(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, size: int = 1, modulate: Color = Color(1, 1, 1, 1), justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_style_box(style_box: StyleBox, rect: Rect2) -> void
func draw_texture(texture: Texture2D, position: Vector2, modulate: Color = Color(1, 1, 1, 1)) -> void
func draw_texture_rect(texture: Texture2D, rect: Rect2, tile: bool, modulate: Color = Color(1, 1, 1, 1), transpose: bool = false) -> void
func draw_texture_rect_region(texture: Texture2D, rect: Rect2, src_rect: Rect2, modulate: Color = Color(1, 1, 1, 1), transpose: bool = false, clip_uv: bool = true) -> void
func force_update_transform() -> void
func get_canvas() -> RID
func hide() -> void
func make_canvas_position_local(viewport_point: Vector2) -> Vector2
func move_to_front() -> void
func queue_redraw() -> void
func set_notify_local_transform(enable: bool) -> void
func set_notify_transform(enable: bool) -> void
func set_visibility_layer_bit(layer: int, enabled: bool) -> void
func show() -> void
Inherited from Node (106)
func _enter_tree() -> void
func _exit_tree() -> void
func _input(event: InputEvent) -> void
func _physics_process(delta: float) -> void
func _process(delta: float) -> void
func _ready() -> void
func _shortcut_input(event: InputEvent) -> void
func _unhandled_input(event: InputEvent) -> void
func _unhandled_key_input(event: InputEvent) -> void
func add_child(node: Node, force_readable_name: bool = false, internal: Node.InternalMode = 0) -> void
func add_sibling(sibling: Node, force_readable_name: bool = false) -> void
func add_to_group(group: StringName, persistent: bool = false) -> void
func atr(message: String, context: StringName = "") -> String
func atr_n(message: String, plural_message: StringName, n: int, context: StringName = "") -> String
func can_process() -> bool
func duplicate(flags: int = 15) -> Node
func find_child(pattern: String, recursive: bool = true, owned: bool = true) -> Node
func find_children(pattern: String, type: String = "", recursive: bool = true, owned: bool = true) -> Node[]
func find_parent(pattern: String) -> Node
func get_child(idx: int, include_internal: bool = false) -> Node
func get_child_count(include_internal: bool = false) -> int
func get_children(include_internal: bool = false) -> Node[]
func get_groups() -> StringName[]
func get_index(include_internal: bool = false) -> int
func get_node(path: NodePath) -> Node
func get_orphan_node_ids() -> int[]
func get_parent() -> Node
func get_path() -> NodePath
func get_path_to(node: Node, use_unique_path: bool = false) -> NodePath
func get_window() -> Window
func has_node(path: NodePath) -> bool
func is_ancestor_of(node: Node) -> bool
func is_greater_than(node: Node) -> bool
func is_in_group(group: StringName) -> bool
func move_child(child_node: Node, to_index: int) -> void
func notify_deferred_thread_group(what: int) -> void
func notify_thread_safe(what: int) -> void
func print_orphan_nodes() -> void
func print_tree() -> void
func print_tree_pretty() -> void
func propagate_call(method: StringName, args: Array = [], parent_first: bool = false) -> void
func propagate_notification(what: int) -> void
func queue_free() -> void
func remove_child(node: Node) -> void
func remove_from_group(group: StringName) -> void
func reparent(new_parent: Node, keep_global_transform: bool = true) -> void
func replace_by(node: Node, keep_groups: bool = false) -> void
func request_ready() -> void
func rpc(method: StringName) -> Error
func rpc_config(method: StringName, config: Variant) -> void
func rpc_id(peer_id: int, method: StringName) -> Error
func set_deferred_thread_group(property: StringName, value: Variant) -> void
func set_display_folded(fold: bool) -> void
func set_editable_instance(node: Node, is_editable: bool) -> void
func set_multiplayer_authority(id: int, recursive: bool = true) -> void
func set_physics_process(enable: bool) -> void
func set_physics_process_internal(enable: bool) -> void
func set_process(enable: bool) -> void
func set_process_input(enable: bool) -> void
func set_process_internal(enable: bool) -> void
func set_process_shortcut_input(enable: bool) -> void
func set_process_unhandled_input(enable: bool) -> void
func set_scene_instance_load_placeholder(load_placeholder: bool) -> void
func set_thread_safe(property: StringName, value: Variant) -> void
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

signal caret_changed()

Emitted when any caret changes position.

signal gutter_added()

Emitted when a gutter is added.

signal gutter_clicked(line: int, gutter: int)

Emitted when a gutter is clicked.

signal gutter_removed()

Emitted when a gutter is removed.

signal lines_edited_from(from_line: int, to_line: int)

Emitted immediately when the text changes.

When text is added from_line will be less than to_line. On a remove to_line will be less than from_line.

signal text_changed()

Emitted when the text changes.

signal text_set()

Emitted when clear() is called or text is set.

Inherited from Control (10)
signal focus_entered()
signal focus_exited()
signal gui_input(event: InputEvent)
signal mouse_entered()
signal mouse_exited()
signal resized()
signal theme_changed()
Inherited from CanvasItem (4)
signal draw()
signal hidden()
Inherited from Node (11)
signal child_entered_tree(node: Node)
signal child_exiting_tree(node: Node)
signal ready()
signal renamed()
signal replacing_by(node: Node)
signal tree_entered()
signal tree_exited()
signal tree_exiting()
Inherited from Object (2)

Enums & Constants

enum MenuItems
MENU_CUT = 0

Cuts (copies and clears) the selected text.

MENU_COPY = 1

Copies the selected text.

MENU_PASTE = 2

Pastes the clipboard text over the selected text (or at the cursor's position).

MENU_CLEAR = 3

Erases the whole TextEdit text.

MENU_SELECT_ALL = 4

Selects the whole TextEdit text.

MENU_UNDO = 5

Undoes the previous action.

MENU_REDO = 6

Redoes the previous action.

MENU_SUBMENU_TEXT_DIR = 7

ID of "Text Writing Direction" submenu.

MENU_DIR_INHERITED = 8

Sets text direction to inherited.

MENU_DIR_AUTO = 9

Sets text direction to automatic.

MENU_DIR_LTR = 10

Sets text direction to left-to-right.

MENU_DIR_RTL = 11

Sets text direction to right-to-left.

MENU_DISPLAY_UCC = 12

Toggles control character display.

MENU_SUBMENU_INSERT_UCC = 13

ID of "Insert Control Character" submenu.

MENU_INSERT_LRM = 14

Inserts left-to-right mark (LRM) character.

MENU_INSERT_RLM = 15

Inserts right-to-left mark (RLM) character.

MENU_INSERT_LRE = 16

Inserts start of left-to-right embedding (LRE) character.

MENU_INSERT_RLE = 17

Inserts start of right-to-left embedding (RLE) character.

MENU_INSERT_LRO = 18

Inserts start of left-to-right override (LRO) character.

MENU_INSERT_RLO = 19

Inserts start of right-to-left override (RLO) character.

MENU_INSERT_PDF = 20

Inserts pop direction formatting (PDF) character.

MENU_INSERT_ALM = 21

Inserts Arabic letter mark (ALM) character.

MENU_INSERT_LRI = 22

Inserts left-to-right isolate (LRI) character.

MENU_INSERT_RLI = 23

Inserts right-to-left isolate (RLI) character.

MENU_INSERT_FSI = 24

Inserts first strong isolate (FSI) character.

MENU_INSERT_PDI = 25

Inserts pop direction isolate (PDI) character.

MENU_INSERT_ZWJ = 26

Inserts zero width joiner (ZWJ) character.

MENU_INSERT_ZWNJ = 27

Inserts zero width non-joiner (ZWNJ) character.

MENU_INSERT_WJ = 28

Inserts word joiner (WJ) character.

MENU_INSERT_SHY = 29

Inserts soft hyphen (SHY) character.

MENU_EMOJI_AND_SYMBOL = 30

Opens system emoji and symbol picker.

MENU_MAX = 31

Represents the size of the MenuItems enum.

enum EditAction
ACTION_NONE = 0

No current action.

ACTION_TYPING = 1

A typing action.

ACTION_BACKSPACE = 2

A backwards delete action.

ACTION_DELETE = 3

A forward delete action.

enum SearchFlags
SEARCH_MATCH_CASE = 1

Match case when searching.

SEARCH_WHOLE_WORDS = 2

Match whole words when searching.

SEARCH_BACKWARDS = 4

Search from end to beginning.

enum CaretType
CARET_TYPE_LINE = 0

Vertical line caret.

CARET_TYPE_BLOCK = 1

Block caret.

enum SelectionMode
SELECTION_MODE_NONE = 0

Not selecting.

SELECTION_MODE_SHIFT = 1

Select as if shift is pressed.

SELECTION_MODE_POINTER = 2

Select single characters as if the user single clicked.

SELECTION_MODE_WORD = 3

Select whole words as if the user double clicked.

SELECTION_MODE_LINE = 4

Select whole lines as if the user triple clicked.

enum LineWrappingMode
LINE_WRAPPING_NONE = 0

Line wrapping is disabled.

LINE_WRAPPING_BOUNDARY = 1

Line wrapping occurs at the control boundary, beyond what would normally be visible.

enum GutterType
GUTTER_TYPE_STRING = 0

When a gutter is set to string using set_gutter_type(), it is used to contain text set via the set_line_gutter_text() method.

GUTTER_TYPE_ICON = 1

When a gutter is set to icon using set_gutter_type(), it is used to contain an icon set via the set_line_gutter_icon() method.

GUTTER_TYPE_CUSTOM = 2

When a gutter is set to custom using set_gutter_type(), it is used to contain custom visuals controlled by a callback method set via the set_gutter_custom_draw() method.