Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

TextEdit

Inherits: Control < CanvasItem < Node < Object

Inherited By: CodeEdit

A multiline text editor.

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.

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

AutowrapMode

autowrap_mode

3

bool

caret_blink

false

float

caret_blink_interval

0.65

bool

caret_draw_when_editable_disabled

false

bool

caret_mid_grapheme

false

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