Inherits: Control < CanvasItem < Node < Object
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.
bool | breakpoint_gutter | false |
bool | caret_blink | false |
float | caret_blink_speed | 0.65 |
bool | caret_block_mode | false |
bool | caret_moving_by_right_click | true |
bool | context_menu_enabled | true |
bool | draw_spaces | false |
bool | draw_tabs | false |
FocusMode | focus_mode |
2 (parent override)
|
bool | fold_gutter | false |
bool | hiding_enabled | false |
bool | highlight_all_occurrences | false |
bool | highlight_current_line | false |
bool | minimap_draw | false |
int | minimap_width | 80 |
CursorShape | mouse_default_cursor_shape |
1 (parent override)
|
bool | override_selected_font_color | false |
bool | readonly | false |
int | scroll_horizontal | 0 |
float | scroll_vertical | 0.0 |
bool | selecting_enabled | true |
bool | shortcut_keys_enabled | true |
bool | show_line_numbers | false |
bool | smooth_scrolling | false |
bool | syntax_highlighting | false |
String | text | "" |
float | v_scroll_speed | 80.0 |
bool | virtual_keyboard_enabled | true |
bool | wrap_enabled | false |
Color | background_color | Color( 0, 0, 0, 0 ) |
Color | bookmark_color | Color( 0.08, 0.49, 0.98, 1 ) |
Color | brace_mismatch_color | Color( 1, 0.2, 0.2, 1 ) |
Color | breakpoint_color | Color( 0.8, 0.8, 0.4, 0.2 ) |
Color | caret_background_color | Color( 0, 0, 0, 1 ) |
Color | caret_color | Color( 0.88, 0.88, 0.88, 1 ) |
Color | code_folding_color | Color( 0.8, 0.8, 0.8, 0.8 ) |
StyleBox | completion | |
Color | completion_background_color | Color( 0.17, 0.16, 0.2, 1 ) |
Color | completion_existing_color | Color( 0.87, 0.87, 0.87, 0.13 ) |
Color | completion_font_color | Color( 0.67, 0.67, 0.67, 1 ) |
int | completion_lines | 7 |
int | completion_max_width | 50 |
Color | completion_scroll_color | Color( 1, 1, 1, 1 ) |
int | completion_scroll_width | 3 |
Color | completion_selected_color | Color( 0.26, 0.26, 0.27, 1 ) |
Color | current_line_color | Color( 0.25, 0.25, 0.26, 0.8 ) |
Color | executing_line_color | Color( 0.2, 0.8, 0.2, 0.4 ) |
StyleBox | focus | |
Texture | fold | |
Texture | folded | |
Font | font | |
Color | font_color | Color( 0.88, 0.88, 0.88, 1 ) |
Color | font_color_readonly | Color( 0.88, 0.88, 0.88, 0.5 ) |
Color | font_color_selected | Color( 0, 0, 0, 1 ) |
Color | function_color | Color( 0.4, 0.64, 0.81, 1 ) |
Color | line_number_color | Color( 0.67, 0.67, 0.67, 0.4 ) |
int | line_spacing | 4 |
Color | mark_color | Color( 1, 0.4, 0.4, 0.4 ) |
Color | member_variable_color | Color( 0.9, 0.31, 0.35, 1 ) |
StyleBox | normal | |
Color | number_color | Color( 0.92, 0.58, 0.2, 1 ) |
StyleBox | read_only | |
Color | safe_line_number_color | Color( 0.67, 0.78, 0.67, 0.6 ) |
Color | selection_color | Color( 0.49, 0.49, 0.49, 1 ) |
Texture | space | |
Color | symbol_color | Color( 0.94, 0.94, 0.94, 1 ) |
Texture | tab | |
Color | word_highlighted_color | Color( 0.8, 0.9, 0.9, 0.15 ) |
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.
enum SearchFlags:
enum SearchResult:
TextEdit
text.TextEdit
text.Default | false |
Setter | set_breakpoint_gutter_enabled(value) |
Getter | is_breakpoint_gutter_enabled() |
If true
, the breakpoint gutter is visible.
Default | false |
Setter | cursor_set_blink_enabled(value) |
Getter | cursor_get_blink_enabled() |
If true
, the caret (visual cursor) blinks.
Default | 0.65 |
Setter | cursor_set_blink_speed(value) |
Getter | cursor_get_blink_speed() |
Duration (in seconds) of a caret's blinking cycle.
Default | false |
Setter | cursor_set_block_mode(value) |
Getter | cursor_is_block_mode() |
If true
, the caret displays as a rectangle.
If false
, the caret displays as a bar.
Default | true |
Setter | set_right_click_moves_caret(value) |
Getter | is_right_click_moving_caret() |
If true
, a right-click moves the cursor at the mouse position before displaying the context menu.
If false
, the context menu disregards mouse location.
Default | true |
Setter | set_context_menu_enabled(value) |
Getter | is_context_menu_enabled() |
If true
, a right-click displays the context menu.
Default | false |
Setter | set_draw_spaces(value) |
Getter | is_drawing_spaces() |
If true
, the "space" character will have a visible representation.
Default | false |
Setter | set_draw_tabs(value) |
Getter | is_drawing_tabs() |
If true
, the "tab" character will have a visible representation.
Default | false |
Setter | set_draw_fold_gutter(value) |
Getter | is_drawing_fold_gutter() |
If true
, the fold gutter is visible. This enables folding groups of indented lines.
Default | false |
Setter | set_hiding_enabled(value) |
Getter | is_hiding_enabled() |
If true
, all lines that have been set to hidden by set_line_as_hidden, will not be visible.
Default | false |
Setter | set_highlight_all_occurrences(value) |
Getter | is_highlight_all_occurrences_enabled() |
If true
, all occurrences of the selected text will be highlighted.
Default | false |
Setter | set_highlight_current_line(value) |
Getter | is_highlight_current_line_enabled() |
If true
, the line containing the cursor is highlighted.
Default | false |
Setter | draw_minimap(value) |
Getter | is_drawing_minimap() |
If true
, a minimap is shown, providing an outline of your source code.
Default | 80 |
Setter | set_minimap_width(value) |
Getter | get_minimap_width() |
The width, in pixels, of the minimap.
Default | false |
Setter | set_override_selected_font_color(value) |
Getter | is_overriding_selected_font_color() |
If true
, custom font_color_selected
will be used for selected text.
Default | false |
Setter | set_readonly(value) |
Getter | is_readonly() |
If true
, read-only mode is enabled. Existing text cannot be modified and new text cannot be added.
Default | 0 |
Setter | set_h_scroll(value) |
Getter | get_h_scroll() |
The current horizontal scroll value.
Default | 0.0 |
Setter | set_v_scroll(value) |
Getter | get_v_scroll() |
The current vertical scroll value.
Default | true |
Setter | set_selecting_enabled(value) |
Getter | is_selecting_enabled() |
If true
, text can be selected.
If false
, text can not be selected by the user or by the select or select_all methods.
Default | true |
Setter | set_shortcut_keys_enabled(value) |
Getter | is_shortcut_keys_enabled() |
If true
, shortcut keys for context menu items are enabled, even if the context menu is disabled.
Default | false |
Setter | set_show_line_numbers(value) |
Getter | is_show_line_numbers_enabled() |
If true
, line numbers are displayed to the left of the text.
Default | false |
Setter | set_smooth_scroll_enable(value) |
Getter | is_smooth_scroll_enabled() |
If true
, sets the step
of the scrollbars to 0.25
which results in smoother scrolling.
Default | false |
Setter | set_syntax_coloring(value) |
Getter | is_syntax_coloring_enabled() |
If true
, any custom color properties that have been set for this TextEdit
will be visible.
Default | "" |
Setter | set_text(value) |
Getter | get_text() |
String value of the TextEdit
.
Default | 80.0 |
Setter | set_v_scroll_speed(value) |
Getter | get_v_scroll_speed() |
Vertical scroll sensitivity.
Default | true |
Setter | set_virtual_keyboard_enabled(value) |
Getter | is_virtual_keyboard_enabled() |
If true
, the native virtual keyboard is shown when focused on platforms that support it.
Default | false |
Setter | set_wrap_enabled(value) |
Getter | is_wrap_enabled() |
If true
, enables text wrapping when it goes beyond the edge of what is visible.
Adds color region (given the delimiters) and its colors.
Adds a keyword
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 scroll_horizontal value to 0
.
Clears all custom syntax coloring information previously added with add_color_region or 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 column
index.
If adjust_viewport
is set to true
, the viewport will center at the cursor position after the move occurs.
Moves the cursor at the specified line
index.
If adjust_viewport
is set to true
, the viewport will center at the cursor position after the move occurs.
If can_be_hidden
is set to true
, the specified line
can be hidden using set_line_as_hidden.
Cut's the current selection.
Deselects the current selection.
Folds all lines that are possible to be folded (see can_fold).
Folds the given line, if possible (see can_fold).
Returns an array containing the line number of each breakpoint.
Returns the Color of the specified keyword
.
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 mouse cursor location.
Returns whether the specified keyword
has a color set to it or not.
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 true
if the selection is active.
Triggers a right-click menu action by the specified index. See MenuItems for a list of available indexes.
Paste the current selection.
Perform redo operation.
Removes all the breakpoints. This will not fire the breakpoint_toggled signal.
Perform a search inside the text. Search flags can be specified in the SearchFlags enum.
Returns an empty PoolIntArray
if no result was found. Otherwise, the result line and column can be accessed at indices specified in the SearchResult enum, e.g:
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]
Perform selection, from line/column to line/column.
If selecting_enabled is false
, no selection will occur.
Select all the text.
If selecting_enabled is false
, no selection will occur.
Sets the text for a specific line.
If true
, hides the line of the specified index.
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 set_line_as_hidden.
© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/3.2/classes/class_textedit.html