Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

TextEdit

Inherits: Control < CanvasItem < Node < Object

Inherited By: CodeEdit

Multiline text editing control.

Description

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.

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.

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

bool

caret_blink

false

float

caret_blink_interval

0.65

bool

caret_draw_when_editable_disabled

false

bool

caret_mid_grapheme

true

bool

caret_move_on_right_click

true

bool

caret_multiple

true

CaretType

caret_type

0

bool

context_menu_enabled

true

bool

deselect_on_focus_loss_enabled

true

bool

drag_and_drop_selection_enabled

true

bool

draw_control_chars

false

bool

draw_spaces

false

bool

draw_tabs

false

bool

editable

true

FocusMode

focus_mode

2 (overrides Control)

bool

highlight_all_occurrences

false

bool

highlight_current_line

false

String

language

""

bool

middle_mouse_paste_enabled

true

bool

minimap_draw

false

int

minimap_width

80

CursorShape

mouse_default_cursor_shape

1 (overrides Control)

String

placeholder_text

""

bool

scroll_fit_content_height

false

int

scroll_horizontal

0

bool

scroll_past_end_of_file

false

bool

scroll_smooth

false

float

scroll_v_scroll_speed

80.0

float

scroll_vertical

0.0

bool

selecting_enabled

true

bool

shortcut_keys_enabled

true

StructuredTextParser

structured_text_bidi_override

0

Array

structured_text_bidi_override_options

[]

SyntaxHighlighter

syntax_highlighter

String

text

""

TextDirection

text_direction

0

bool

virtual_keyboard_enabled

true

LineWrappingMode

wrap_mode

0

Methods

void

_backspace ( int caret_index ) virtual

void

_copy ( int caret_index ) virtual

void

_cut ( int caret_index ) virtual

void

_handle_unicode_input ( int unicode_char, int caret_index ) virtual

void

_paste ( int caret_index ) virtual

void

_paste_primary_clipboard ( int caret_index ) virtual

int

add_caret ( int line, int col )

void

add_caret_at_carets ( bool below )

void

add_gutter ( int at=-1 )

void

add_selection_for_next_occurrence ( )

void

adjust_carets_after_edit ( int caret, int from_line, int from_col, int to_line, int to_col )

void

adjust_viewport_to_caret ( int caret_index=0 )

void

backspace ( int caret_index=-1 )

void

begin_complex_operation ( )

void

center_viewport_to_caret ( int caret_index=0 )

void

clear ( )

void

clear_undo_history ( )

void

copy ( int caret_index=-1 )

void

cut ( int caret_index=-1 )

void

delete_selection ( int caret_index=-1 )

void

deselect ( int caret_index=-1 )

void

end_action ( )

void

end_complex_operation ( )

int

get_caret_column ( int caret_index=0 ) const

int

get_caret_count ( ) const

Vector2

get_caret_draw_pos ( int caret_index=0 ) const

PackedInt32Array

get_caret_index_edit_order ( )

int

get_caret_line ( int caret_index=0 ) const

int

get_caret_wrap_index ( int caret_index=0 ) const

int

get_first_non_whitespace_column ( int line ) const

int

get_first_visible_line ( ) const

int

get_gutter_count ( ) const

String

get_gutter_name ( int gutter ) const

GutterType

get_gutter_type ( int gutter ) const

int

get_gutter_width ( int gutter ) const

HScrollBar

get_h_scroll_bar ( ) const

int

get_indent_level ( int line ) const

int

get_last_full_visible_line ( ) const

int

get_last_full_visible_line_wrap_index ( ) const

int

get_last_unhidden_line ( ) const

String

get_line ( int line ) const

Color

get_line_background_color ( int line ) const

Vector2i

get_line_column_at_pos ( Vector2i position, bool allow_out_of_bounds=true ) const

int

get_line_count ( ) const

Texture2D

get_line_gutter_icon ( int line, int gutter ) const

Color

get_line_gutter_item_color ( int line, int gutter ) const

Variant

get_line_gutter_metadata ( int line, int gutter ) const

String

get_line_gutter_text ( int line, int gutter ) const

int

get_line_height ( ) const

int

get_line_width ( int line, int wrap_index=-1 ) const

int

get_line_wrap_count ( int line ) const

int

get_line_wrap_index_at_column ( int line, int column ) const

PackedStringArray

get_line_wrapped_text ( int line ) const

Vector2

get_local_mouse_pos ( ) const

PopupMenu

get_menu ( ) const

int

get_minimap_line_at_pos ( Vector2i position ) const

int

get_minimap_visible_lines ( ) const