2017-09-12 20:42:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2024-02-21 17:51:08 +00:00
<class name= "TextEdit" inherits= "Control" keywords= "textarea" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 20:42:36 +00:00
<brief_description >
2023-04-30 14:26:09 +00:00
A multiline text editor.
2017-09-12 20:42:36 +00:00
</brief_description>
<description >
2023-04-30 14:26:09 +00:00
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].
2022-06-08 22:10:34 +00:00
[b]Note:[/b] Most viewport, caret and edit methods contain a [code]caret_index[/code] argument for [member caret_multiple] support. The argument should be one of the following: [code]-1[/code] for all carets, [code]0[/code] for the main caret, or greater than [code]0[/code] for secondary carets.
2021-05-09 23:27:54 +00:00
[b]Note:[/b] When holding down [kbd]Alt[/kbd], the vertical scroll wheel will scroll 5 times as fast as it would normally do. This also works in the Godot script editor.
2017-09-12 20:42:36 +00:00
</description>
<tutorials >
</tutorials>
<methods >
2021-06-15 14:05:01 +00:00
<method name= "_backspace" qualifiers= "virtual" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" />
2021-06-15 14:05:01 +00:00
<description >
2021-07-10 13:01:25 +00:00
Override this method to define what happens when the user presses the backspace key.
2021-07-08 15:48:58 +00:00
</description>
</method>
<method name= "_copy" qualifiers= "virtual" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" />
2021-07-08 15:48:58 +00:00
<description >
2021-07-10 13:01:25 +00:00
Override this method to define what happens when the user performs a copy operation.
2021-07-08 15:48:58 +00:00
</description>
</method>
<method name= "_cut" qualifiers= "virtual" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" />
2021-07-08 15:48:58 +00:00
<description >
2021-07-10 13:01:25 +00:00
Override this method to define what happens when the user performs a cut operation.
2021-06-15 14:05:01 +00:00
</description>
</method>
2021-06-28 16:14:44 +00:00
<method name= "_handle_unicode_input" qualifiers= "virtual" >
2021-07-01 16:40:59 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "unicode_char" type= "int" />
2022-06-08 22:10:34 +00:00
<param index= "1" name= "caret_index" type= "int" />
2021-06-28 16:14:44 +00:00
<description >
2022-08-09 15:19:47 +00:00
Override this method to define what happens when the user types in the provided key [param unicode_char].
2021-07-08 15:48:58 +00:00
</description>
</method>
<method name= "_paste" qualifiers= "virtual" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" />
2021-07-08 15:48:58 +00:00
<description >
2021-07-10 13:01:25 +00:00
Override this method to define what happens when the user performs a paste operation.
2021-06-28 16:14:44 +00:00
</description>
</method>
2021-10-12 07:43:50 +00:00
<method name= "_paste_primary_clipboard" qualifiers= "virtual" >
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" />
2021-10-12 07:43:50 +00:00
<description >
Override this method to define what happens when the user performs a paste operation with middle mouse button.
[b]Note:[/b] This method is only implemented on Linux.
</description>
</method>
2022-06-08 22:10:34 +00:00
<method name= "add_caret" >
<return type= "int" />
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "col" type= "int" />
<description >
Adds a new caret at the given location. Returns the index of the new caret, or [code]-1[/code] if the location is invalid.
</description>
</method>
2022-10-09 15:07:42 +00:00
<method name= "add_caret_at_carets" >
<return type= "void" />
<param index= "0" name= "below" type= "bool" />
<description >
Adds an additional caret above or below every caret. If [param below] is true the new caret will be added below and above otherwise.
</description>
</method>
2020-09-11 10:22:10 +00:00
<method name= "add_gutter" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "at" type= "int" default= "-1" />
2020-09-11 10:22:10 +00:00
<description >
2022-08-09 15:19:47 +00:00
Register a new gutter to this [TextEdit]. Use [param at] to have a specific gutter order. A value of [code]-1[/code] appends the gutter to the right.
2020-09-11 10:22:10 +00:00
</description>
</method>
2022-10-19 17:35:14 +00:00
<method name= "add_selection_for_next_occurrence" >
<return type= "void" />
<description >
Adds a selection and a caret for the next occurrence of the current selection. If there is no active selection, selects word under caret.
</description>
</method>
2022-06-08 22:10:34 +00:00
<method name= "adjust_carets_after_edit" >
<return type= "void" />
<param index= "0" name= "caret" type= "int" />
<param index= "1" name= "from_line" type= "int" />
<param index= "2" name= "from_col" type= "int" />
<param index= "3" name= "to_line" type= "int" />
<param index= "4" name= "to_col" type= "int" />
<description >
Reposition the carets affected by the edit. This assumes edits are applied in edit order, see [method get_caret_index_edit_order].
</description>
</method>
2021-07-09 16:27:09 +00:00
<method name= "adjust_viewport_to_caret" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2021-07-09 16:27:09 +00:00
<description >
Adjust the viewport so the caret is visible.
</description>
</method>
2024-01-22 17:34:12 +00:00
<method name= "apply_ime" >
<return type= "void" />
<description >
Applies text from the [url=https://en.wikipedia.org/wiki/Input_method]Input Method Editor[/url] (IME) to each caret and closes the IME if it is open.
</description>
</method>
2021-06-15 14:05:01 +00:00
<method name= "backspace" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "-1" />
2021-06-15 14:05:01 +00:00
<description >
2021-07-10 13:01:25 +00:00
Called when the user presses the backspace key. Can be overridden with [method _backspace].
</description>
</method>
<method name= "begin_complex_operation" >
<return type= "void" />
<description >
Starts a multipart edit. All edits will be treated as one action until [method end_complex_operation] is called.
2021-06-15 14:05:01 +00:00
</description>
</method>
2024-01-22 17:34:12 +00:00
<method name= "cancel_ime" >
<return type= "void" />
<description >
Closes the [url=https://en.wikipedia.org/wiki/Input_method]Input Method Editor[/url] (IME) if it is open. Any text in the IME will be lost.
</description>
</method>
2021-07-08 17:35:56 +00:00
<method name= "center_viewport_to_caret" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2019-06-24 08:39:59 +00:00
<description >
2021-07-10 13:01:25 +00:00
Centers the viewport on the line the editing caret is at. This also resets the [member scroll_horizontal] value to [code]0[/code].
</description>
</method>
<method name= "clear" >
<return type= "void" />
<description >
Performs a full reset of [TextEdit], including undo history.
2019-06-24 08:39:59 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "clear_undo_history" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2017-09-12 20:42:36 +00:00
<description >
2019-06-13 09:12:52 +00:00
Clears the undo history.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "copy" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "-1" />
2017-09-12 20:42:36 +00:00
<description >
2021-07-10 13:01:25 +00:00
Copies the current text selection. Can be overridden with [method _copy].
2017-09-12 20:42:36 +00:00
</description>
</method>
2021-07-08 17:35:56 +00:00
<method name= "cut" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "-1" />
2017-09-12 20:42:36 +00:00
<description >
2021-07-10 13:01:25 +00:00
Cut's the current selection. Can be overridden with [method _cut].
2017-09-12 20:42:36 +00:00
</description>
</method>
2021-07-08 17:35:56 +00:00
<method name= "delete_selection" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "-1" />
2017-09-12 20:42:36 +00:00
<description >
2021-07-10 13:01:25 +00:00
Deletes the selected text.
2017-09-12 20:42:36 +00:00
</description>
</method>
2021-07-08 17:35:56 +00:00
<method name= "deselect" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "-1" />
2017-09-12 20:42:36 +00:00
<description >
2021-07-08 17:35:56 +00:00
Deselects the current selection.
2017-09-12 20:42:36 +00:00
</description>
</method>
2022-06-08 22:10:34 +00:00
<method name= "end_action" >
<return type= "void" />
<description >
Marks the end of steps in the current action started with [method start_action].
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "end_complex_operation" >
<return type= "void" />
<description >
Ends a multipart edit, started with [method begin_complex_operation]. If called outside a complex operation, the current operation is pushed onto the undo/redo stack.
</description>
</method>
2021-07-08 17:35:56 +00:00
<method name= "get_caret_column" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "int" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2017-09-12 20:42:36 +00:00
<description >
2021-07-08 17:35:56 +00:00
Returns the column the editing caret is at.
2017-09-12 20:42:36 +00:00
</description>
</method>
2022-06-08 22:10:34 +00:00
<method name= "get_caret_count" qualifiers= "const" >
<return type= "int" />
<description >
Returns the number of carets in this [TextEdit].
</description>
</method>
2021-07-08 17:35:56 +00:00
<method name= "get_caret_draw_pos" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "Vector2" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2021-06-15 14:05:01 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns the caret pixel draw position.
2021-06-15 14:05:01 +00:00
</description>
</method>
2022-06-08 22:10:34 +00:00
<method name= "get_caret_index_edit_order" >
<return type= "PackedInt32Array" />
<description >
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 [method insert_text_at_caret] are applied.
</description>
</method>
2021-07-08 17:35:56 +00:00
<method name= "get_caret_line" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "int" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2017-12-16 19:34:16 +00:00
<description >
2021-07-08 17:35:56 +00:00
Returns the line the editing caret is on.
2017-12-16 19:34:16 +00:00
</description>
</method>
2021-07-08 17:35:56 +00:00
<method name= "get_caret_wrap_index" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "int" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2021-05-22 14:11:04 +00:00
<description >
2021-07-08 17:35:56 +00:00
Returns the wrap index the editing caret is on.
2021-05-22 14:11:04 +00:00
</description>
</method>
2021-06-15 14:05:01 +00:00
<method name= "get_first_non_whitespace_column" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2021-06-15 14:05:01 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns the first column containing a non-whitespace character.
2021-06-15 14:05:01 +00:00
</description>
</method>
2021-07-09 16:27:09 +00:00
<method name= "get_first_visible_line" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "int" />
2021-07-09 16:27:09 +00:00
<description >
Returns the first visible line.
</description>
</method>
2020-09-11 10:22:10 +00:00
<method name= "get_gutter_count" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2022-08-17 22:08:09 +00:00
Returns the number of gutters registered.
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "get_gutter_name" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "String" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns the name of the gutter at the given index.
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "get_gutter_type" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" enum= "TextEdit.GutterType" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2024-02-26 17:02:17 +00:00
Returns the type of the gutter at the given index. Gutters can contain icons, text, or custom visuals. See [enum TextEdit.GutterType] for options.
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "get_gutter_width" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
2018-05-30 12:02:51 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns the width of the gutter at the given index.
2018-05-30 12:02:51 +00:00
</description>
</method>
2022-09-28 04:55:06 +00:00
<method name= "get_h_scroll_bar" qualifiers= "const" >
<return type= "HScrollBar" />
<description >
Returns the [HScrollBar] used by [TextEdit].
</description>
</method>
2021-06-15 14:05:01 +00:00
<method name= "get_indent_level" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2021-06-15 14:05:01 +00:00
<description >
2022-08-17 22:08:09 +00:00
Returns the number of spaces and [code]tab * tab_size[/code] before the first char.
2021-06-15 14:05:01 +00:00
</description>
</method>
2021-07-09 16:27:09 +00:00
<method name= "get_last_full_visible_line" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "int" />
2021-07-09 16:27:09 +00:00
<description >
2022-01-02 17:32:49 +00:00
Returns the last visible line. Use [method get_last_full_visible_line_wrap_index] for the wrap index.
2021-07-09 16:27:09 +00:00
</description>
</method>
<method name= "get_last_full_visible_line_wrap_index" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "int" />
2021-07-09 16:27:09 +00:00
<description >
Returns the last visible wrap index of the last visible line.
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "get_last_unhidden_line" qualifiers= "const" >
<return type= "int" />
<description >
Returns the last unhidden line in the entire [TextEdit].
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "get_line" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "String" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2019-05-24 02:15:43 +00:00
Returns the text of a specific line.
2017-09-12 20:42:36 +00:00
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "get_line_background_color" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Color" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2020-09-10 20:25:00 +00:00
<description >
Returns the current background color of the line. [code]Color(0, 0, 0, 0)[/code] is returned if no color is set.
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "get_line_column_at_pos" qualifiers= "const" >
<return type= "Vector2i" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "position" type= "Vector2i" />
<param index= "1" name= "allow_out_of_bounds" type= "bool" default= "true" />
2021-07-10 13:01:25 +00:00
<description >
2022-08-09 15:19:47 +00:00
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. If [param allow_out_of_bounds] is [code]false[/code] and the position is not over the text, both vector values will be set to [code]-1[/code].
2021-07-10 13:01:25 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "get_line_count" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-17 22:08:09 +00:00
Returns the number of lines in the text.
2017-09-12 20:42:36 +00:00
</description>
</method>
2020-09-11 10:22:10 +00:00
<method name= "get_line_gutter_icon" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Texture2D" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "gutter" type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2024-02-26 17:02:17 +00:00
Returns the icon currently in [param gutter] at [param line]. This only works when the gutter type is [constant GUTTER_TYPE_ICON] (see [method set_gutter_type]).
2020-09-11 10:22:10 +00:00
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "get_line_gutter_item_color" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Color" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "gutter" type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2022-08-09 15:19:47 +00:00
Returns the color currently in [param gutter] at [param line].
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "get_line_gutter_metadata" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Variant" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "gutter" type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2022-08-09 15:19:47 +00:00
Returns the metadata currently in [param gutter] at [param line].
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "get_line_gutter_text" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "String" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "gutter" type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2024-02-26 17:02:17 +00:00
Returns the text currently in [param gutter] at [param line]. This only works when the gutter type is [constant GUTTER_TYPE_STRING] (see [method set_gutter_type]).
2021-07-10 13:01:25 +00:00
</description>
</method>
<method name= "get_line_height" qualifiers= "const" >
<return type= "int" />
<description >
2023-04-30 02:54:50 +00:00
Returns the maximum value of the line height among all lines.
[b]Note:[/b] The return value is influenced by [theme_item line_spacing] and [theme_item font_size]. And it will not be less than [code]1[/code].
2021-07-10 13:01:25 +00:00
</description>
</method>
<method name= "get_line_width" qualifiers= "const" >
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "wrap_index" type= "int" default= "-1" />
2021-07-10 13:01:25 +00:00
<description >
2022-08-09 15:19:47 +00:00
Returns the width in pixels of the [param wrap_index] on [param line].
2020-09-11 10:22:10 +00:00
</description>
</method>
2021-07-09 10:52:49 +00:00
<method name= "get_line_wrap_count" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2021-07-09 10:52:49 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns the number of times the given line is wrapped.
2021-07-09 10:52:49 +00:00
</description>
</method>
<method name= "get_line_wrap_index_at_column" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "column" type= "int" />
2021-07-09 10:52:49 +00:00
<description >
Returns the wrap index of the given line column.
</description>
</method>
<method name= "get_line_wrapped_text" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "PackedStringArray" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2021-07-10 13:01:25 +00:00
<description >
Returns an array of [String]s representing each wrapped index.
</description>
</method>
<method name= "get_local_mouse_pos" qualifiers= "const" >
<return type= "Vector2" />
2021-07-09 10:52:49 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns the local mouse position adjusted for the text direction.
2021-07-09 10:52:49 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "get_menu" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "PopupMenu" />
2017-09-12 20:42:36 +00:00
<description >
2019-04-24 07:59:17 +00:00
Returns the [PopupMenu] of this [TextEdit]. By default, this menu is displayed when right-clicking on the [TextEdit].
2023-01-26 17:59:41 +00:00
You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see [enum MenuItems]). For example:
[codeblocks]
[gdscript]
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())
[/gdscript]
[csharp]
public override void _Ready()
{
var menu = GetMenu();
// Remove all items after "Redo".
menu.ItemCount = menu.GetItemIndex(TextEdit.MenuItems.Redo) + 1;
// Add custom items.
menu.AddSeparator();
menu.AddItem("Insert Date", TextEdit.MenuItems.Max + 1);
// Add event handler.
menu.IdPressed += OnItemPressed;
}
public void OnItemPressed(int id)
{
if (id == TextEdit.MenuItems.Max + 1)
{
InsertTextAtCaret(Time.GetDateStringFromSystem());
}
}
[/csharp]
[/codeblocks]
2021-10-10 19:28:56 +00:00
[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 Window.visible] property.
2017-09-12 20:42:36 +00:00
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "get_minimap_line_at_pos" qualifiers= "const" >
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "position" type= "Vector2i" />
2021-07-10 13:01:25 +00:00
<description >
2023-02-11 16:18:33 +00:00
Returns the equivalent minimap line at [param position].
2021-07-10 13:01:25 +00:00
</description>
</method>
2021-07-09 16:27:09 +00:00
<method name= "get_minimap_visible_lines" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "int" />
2021-07-09 16:27:09 +00:00
<description >
2022-08-17 22:08:09 +00:00
Returns the number of lines that may be drawn on the minimap.
2021-07-10 13:01:25 +00:00
</description>
</method>
<method name= "get_next_visible_line_index_offset_from" qualifiers= "const" >
<return type= "Vector2i" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "wrap_index" type= "int" />
<param index= "2" name= "visible_amount" type= "int" />
2021-07-10 13:01:25 +00:00
<description >
Similar to [method get_next_visible_line_offset_from], but takes into account the line wrap indexes. In the returned vector, [code]x[/code] is the line, [code]y[/code] is the wrap index.
</description>
</method>
<method name= "get_next_visible_line_offset_from" qualifiers= "const" >
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "visible_amount" type= "int" />
2021-07-10 13:01:25 +00:00
<description >
2022-08-09 15:19:47 +00:00
Returns the count to the next visible line from [param line] to [code]line + visible_amount[/code]. Can also count backwards. For example if a [TextEdit] has 5 lines with lines 2 and 3 hidden, calling this with [code]line = 1, visible_amount = 1[/code] would return 3.
2021-07-09 16:27:09 +00:00
</description>
</method>
2021-11-18 15:55:43 +00:00
<method name= "get_pos_at_line_column" qualifiers= "const" >
<return type= "Vector2i" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "column" type= "int" />
2021-11-18 15:55:43 +00:00
<description >
2022-08-09 15:19:47 +00:00
Returns the local position for the given [param line] and [param column]. 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.
2021-11-18 15:55:43 +00:00
[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.
</description>
</method>
<method name= "get_rect_at_line_column" qualifiers= "const" >
<return type= "Rect2i" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "column" type= "int" />
2021-11-18 15:55:43 +00:00
<description >
2022-08-09 15:19:47 +00:00
Returns the local position and size for the grapheme at the given [param line] and [param column]. 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.
2021-11-18 15:55:43 +00:00
[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.
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "get_saved_version" qualifiers= "const" >
<return type= "int" />
<description >
2023-02-11 16:18:33 +00:00
Returns the last tagged saved version from [method tag_saved_version].
2021-07-10 13:01:25 +00:00
</description>
</method>
2021-07-09 16:27:09 +00:00
<method name= "get_scroll_pos_for_line" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "wrap_index" type= "int" default= "0" />
2021-07-09 16:27:09 +00:00
<description >
2022-08-09 15:19:47 +00:00
Returns the scroll position for [param wrap_index] of [param line].
2021-07-09 16:27:09 +00:00
</description>
</method>
2022-06-08 22:10:34 +00:00
<method name= "get_selected_text" >
2021-07-10 13:01:25 +00:00
<return type= "String" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "-1" />
2021-07-09 16:27:09 +00:00
<description >
2023-03-08 22:00:27 +00:00
Returns the text inside the selection of a caret, or all the carets if [param caret_index] is its default value [code]-1[/code].
2021-07-09 16:27:09 +00:00
</description>
</method>
2020-11-04 14:38:26 +00:00
<method name= "get_selection_column" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2020-11-04 14:38:26 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns the original start column of the selection.
2020-11-04 14:38:26 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "get_selection_from_column" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2017-09-12 20:42:36 +00:00
<description >
2019-05-24 02:15:43 +00:00
Returns the selection begin column.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_selection_from_line" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2017-09-12 20:42:36 +00:00
<description >
2019-05-24 02:15:43 +00:00
Returns the selection begin line.
2017-09-12 20:42:36 +00:00
</description>
</method>
2020-11-04 14:38:26 +00:00
<method name= "get_selection_line" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2020-11-04 14:38:26 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns the original start line of the selection.
2020-11-04 14:38:26 +00:00
</description>
</method>
<method name= "get_selection_mode" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" enum= "TextEdit.SelectionMode" />
2020-11-04 14:38:26 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns the current selection mode.
2020-11-04 14:38:26 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "get_selection_to_column" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2017-09-12 20:42:36 +00:00
<description >
2019-05-24 02:15:43 +00:00
Returns the selection end column.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_selection_to_line" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2017-09-12 20:42:36 +00:00
<description >
2019-05-24 02:15:43 +00:00
Returns the selection end line.
2017-09-12 20:42:36 +00:00
</description>
</method>
2021-06-15 14:05:01 +00:00
<method name= "get_tab_size" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2021-06-15 14:05:01 +00:00
<description >
2021-07-06 11:22:53 +00:00
Returns the [TextEdit]'s' tab size.
2021-06-15 14:05:01 +00:00
</description>
2021-06-30 17:03:32 +00:00
</method>
<method name= "get_total_gutter_width" qualifiers= "const" >
2021-07-01 16:40:59 +00:00
<return type= "int" />
2021-06-30 17:03:32 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns the total width of all gutters and internal padding.
2021-06-30 17:03:32 +00:00
</description>
2021-06-15 14:05:01 +00:00
</method>
2021-07-09 16:27:09 +00:00
<method name= "get_total_visible_line_count" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "int" />
2021-07-09 16:27:09 +00:00
<description >
2022-08-17 22:08:09 +00:00
Returns the number of lines that may be drawn.
2021-07-10 13:01:25 +00:00
</description>
</method>
2022-09-28 04:55:06 +00:00
<method name= "get_v_scroll_bar" qualifiers= "const" >
<return type= "VScrollBar" />
<description >
Returns the [VScrollBar] of the [TextEdit].
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "get_version" qualifiers= "const" >
<return type= "int" />
<description >
Returns the current version of the [TextEdit]. The version is a count of recorded operations by the undo/redo history.
2021-07-09 16:27:09 +00:00
</description>
</method>
2021-05-07 09:21:04 +00:00
<method name= "get_visible_line_count" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2021-05-07 09:21:04 +00:00
<description >
Returns the number of visible lines, including wrapped text.
</description>
</method>
2021-10-31 18:34:54 +00:00
<method name= "get_visible_line_count_in_range" qualifiers= "const" >
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "from_line" type= "int" />
<param index= "1" name= "to_line" type= "int" />
2021-10-31 18:34:54 +00:00
<description >
Returns the total number of visible + wrapped lines between the two lines.
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "get_word_at_pos" qualifiers= "const" >
<return type= "String" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "position" type= "Vector2" />
2021-07-10 13:01:25 +00:00
<description >
2022-08-09 15:19:47 +00:00
Returns the word at [param position].
2021-07-10 13:01:25 +00:00
</description>
</method>
2021-07-08 17:35:56 +00:00
<method name= "get_word_under_caret" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "String" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "-1" />
2021-07-10 13:01:25 +00:00
<description >
Returns a [String] text with the word under the caret's location.
</description>
</method>
<method name= "has_ime_text" qualifiers= "const" >
<return type= "bool" />
2017-09-12 20:42:36 +00:00
<description >
2024-01-22 17:34:12 +00:00
Returns [code]true[/code] if the user has text in the [url=https://en.wikipedia.org/wiki/Input_method]Input Method Editor[/url] (IME).
2017-09-12 20:42:36 +00:00
</description>
</method>
2021-08-17 03:41:46 +00:00
<method name= "has_redo" qualifiers= "const" >
<return type= "bool" />
<description >
Returns [code]true[/code] if a "redo" action is available.
</description>
</method>
2021-07-09 11:42:55 +00:00
<method name= "has_selection" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "bool" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "-1" />
2021-07-09 11:42:55 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns [code]true[/code] if the user has selected text.
</description>
</method>
2021-08-17 03:41:46 +00:00
<method name= "has_undo" qualifiers= "const" >
<return type= "bool" />
<description >
Returns [code]true[/code] if an "undo" action is available.
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "insert_line_at" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "text" type= "String" />
2021-07-10 13:01:25 +00:00
<description >
2022-08-09 15:19:47 +00:00
Inserts a new line with [param text] at [param line].
2021-07-09 11:42:55 +00:00
</description>
</method>
2021-07-08 17:35:56 +00:00
<method name= "insert_text_at_caret" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "text" type= "String" />
2022-06-08 22:10:34 +00:00
<param index= "1" name= "caret_index" type= "int" default= "-1" />
2017-09-12 20:42:36 +00:00
<description >
2021-07-08 17:35:56 +00:00
Insert the specified text at the caret position.
2017-09-12 20:42:36 +00:00
</description>
</method>
2021-05-22 14:11:04 +00:00
<method name= "is_caret_visible" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "0" />
2021-05-22 14:11:04 +00:00
<description >
Returns [code]true[/code] if the caret is visible on the screen.
</description>
</method>
2021-07-01 16:10:54 +00:00
<method name= "is_dragging_cursor" qualifiers= "const" >
2021-07-01 16:40:59 +00:00
<return type= "bool" />
2021-07-01 16:10:54 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns [code]true[/code] if the user is dragging their mouse for scrolling or selecting.
2021-07-01 16:10:54 +00:00
</description>
</method>
2020-09-11 10:22:10 +00:00
<method name= "is_gutter_clickable" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns whether the gutter is clickable.
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "is_gutter_drawn" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns whether the gutter is currently drawn.
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "is_gutter_overwritable" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns whether the gutter is overwritable.
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "is_line_gutter_clickable" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "gutter" type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns whether the gutter on the given line is clickable.
2020-09-11 10:22:10 +00:00
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "is_line_wrapped" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2021-07-16 21:36:05 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns if the given line is wrapped.
2021-07-16 21:36:05 +00:00
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "is_menu_visible" qualifiers= "const" >
<return type= "bool" />
2021-07-09 10:52:49 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns whether the menu is visible. Use this instead of [code]get_menu().visible[/code] to improve performance (so the creation of the menu is avoided).
2021-07-09 10:52:49 +00:00
</description>
</method>
2021-11-24 21:22:40 +00:00
<method name= "is_mouse_over_selection" qualifiers= "const" >
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "edges" type= "bool" />
2022-06-08 22:10:34 +00:00
<param index= "1" name= "caret_index" type= "int" default= "-1" />
2021-11-24 21:22:40 +00:00
<description >
2022-08-09 15:19:47 +00:00
Returns whether the mouse is over selection. If [param edges] is [code]true[/code], the edges are considered part of the selection.
2021-11-24 21:22:40 +00:00
</description>
</method>
2021-07-09 12:40:05 +00:00
<method name= "is_overtype_mode_enabled" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "bool" />
2021-07-09 12:40:05 +00:00
<description >
2021-07-10 13:01:25 +00:00
Returns whether the user is in overtype mode.
2021-07-09 12:40:05 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "menu_option" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "option" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2023-01-26 17:59:41 +00:00
Executes a given action as defined in the [enum MenuItems] enum.
2017-09-12 20:42:36 +00:00
</description>
</method>
2021-06-15 14:05:01 +00:00
<method name= "merge_gutters" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "from_line" type= "int" />
<param index= "1" name= "to_line" type= "int" />
2021-06-15 14:05:01 +00:00
<description >
2022-08-09 15:19:47 +00:00
Merge the gutters from [param from_line] into [param to_line]. Only overwritable gutters will be copied.
2021-06-15 14:05:01 +00:00
</description>
</method>
2022-06-08 22:10:34 +00:00
<method name= "merge_overlapping_carets" >
<return type= "void" />
<description >
2023-01-21 11:25:29 +00:00
Merges any overlapping carets. Will favor the newest caret, or the caret with a selection.
2022-06-08 22:10:34 +00:00
[b]Note:[/b] 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.
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "paste" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "-1" />
2017-09-12 20:42:36 +00:00
<description >
2021-07-10 13:01:25 +00:00
Paste at the current location. Can be overridden with [method _paste].
2017-09-12 20:42:36 +00:00
</description>
</method>
2022-06-08 22:10:34 +00:00
<method name= "paste_primary_clipboard" >
<return type= "void" />
<param index= "0" name= "caret_index" type= "int" default= "-1" />
<description >
Pastes the primary clipboard.
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "redo" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2017-09-12 20:42:36 +00:00
<description >
Perform redo operation.
</description>
</method>
2022-06-08 22:10:34 +00:00
<method name= "remove_caret" >
<return type= "void" />
<param index= "0" name= "caret" type= "int" />
<description >
Removes the given caret index.
[b]Note:[/b] This can result in adjustment of all other caret indices.
</description>
</method>
2020-09-11 10:22:10 +00:00
<method name= "remove_gutter" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
2018-05-30 12:02:51 +00:00
<description >
2021-07-10 13:01:25 +00:00
Removes the gutter from this [TextEdit].
</description>
</method>
2022-06-08 22:10:34 +00:00
<method name= "remove_secondary_carets" >
<return type= "void" />
<description >
Removes all additional carets.
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "remove_text" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "from_line" type= "int" />
<param index= "1" name= "from_column" type= "int" />
<param index= "2" name= "to_line" type= "int" />
<param index= "3" name= "to_column" type= "int" />
2021-07-10 13:01:25 +00:00
<description >
Removes text between the given positions.
2021-10-05 12:24:34 +00:00
[b]Note:[/b] This does not adjust the caret or selection, which as a result it can end up in an invalid position.
2018-05-30 12:02:51 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "search" qualifiers= "const" >
2021-07-10 13:01:25 +00:00
<return type= "Vector2i" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "text" type= "String" />
<param index= "1" name= "flags" type= "int" />
<param index= "2" name= "from_line" type= "int" />
<param index= "3" name= "from_colum" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2019-11-08 07:33:48 +00:00
Perform a search inside the text. Search flags can be specified in the [enum SearchFlags] enum.
2021-07-10 13:01:25 +00:00
In the returned vector, [code]x[/code] is the column, [code]y[/code] is the line. If no results are found, both are equal to [code]-1[/code].
2020-11-27 23:33:15 +00:00
[codeblocks]
[gdscript]
var result = search("print", SEARCH_WHOLE_WORDS, 0, 0)
2023-01-26 17:59:41 +00:00
if result.x != -1:
2020-01-23 17:41:49 +00:00
# Result found.
2021-07-10 13:01:25 +00:00
var line_number = result.y
var column_number = result.x
2020-11-27 23:33:15 +00:00
[/gdscript]
[csharp]
2022-12-07 15:11:39 +00:00
Vector2I result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0);
if (result.X != -1)
2020-11-27 23:33:15 +00:00
{
// Result found.
2022-12-07 15:11:39 +00:00
int lineNumber = result.Y;
int columnNumber = result.X;
2020-11-27 23:33:15 +00:00
}
[/csharp]
[/codeblocks]
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "select" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "from_line" type= "int" />
<param index= "1" name= "from_column" type= "int" />
<param index= "2" name= "to_line" type= "int" />
<param index= "3" name= "to_column" type= "int" />
2022-06-08 22:10:34 +00:00
<param index= "4" name= "caret_index" type= "int" default= "0" />
2017-09-12 20:42:36 +00:00
<description >
Perform selection, from line/column to line/column.
2020-07-03 11:44:34 +00:00
If [member selecting_enabled] is [code]false[/code], no selection will occur.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "select_all" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2017-09-12 20:42:36 +00:00
<description >
Select all the text.
2020-07-03 11:44:34 +00:00
If [member selecting_enabled] is [code]false[/code], no selection will occur.
2017-09-12 20:42:36 +00:00
</description>
</method>
2021-07-09 11:42:55 +00:00
<method name= "select_word_under_caret" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-06-08 22:10:34 +00:00
<param index= "0" name= "caret_index" type= "int" default= "-1" />
2021-07-09 11:42:55 +00:00
<description >
Selects the word under the caret.
</description>
</method>
2021-07-08 17:35:56 +00:00
<method name= "set_caret_column" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "column" type= "int" />
<param index= "1" name= "adjust_viewport" type= "bool" default= "true" />
2022-06-08 22:10:34 +00:00
<param index= "2" name= "caret_index" type= "int" default= "0" />
2021-07-08 17:35:56 +00:00
<description >
2022-08-09 15:19:47 +00:00
Moves the caret to the specified [param column] index.
If [param adjust_viewport] is [code]true[/code], the viewport will center at the caret position after the move occurs.
2022-06-08 22:10:34 +00:00
[b]Note:[/b] If supporting multiple carets this will not check for any overlap. See [method merge_overlapping_carets].
2021-07-08 17:35:56 +00:00
</description>
</method>
<method name= "set_caret_line" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "adjust_viewport" type= "bool" default= "true" />
<param index= "2" name= "can_be_hidden" type= "bool" default= "true" />
<param index= "3" name= "wrap_index" type= "int" default= "0" />
2022-06-08 22:10:34 +00:00
<param index= "4" name= "caret_index" type= "int" default= "0" />
2021-07-08 17:35:56 +00:00
<description >
2022-08-09 15:19:47 +00:00
Moves the caret to the specified [param line] index.
If [param adjust_viewport] is [code]true[/code], the viewport will center at the caret position after the move occurs.
2023-04-26 19:36:04 +00:00
If [param can_be_hidden] is [code]true[/code], the specified [param line] can be hidden.
2022-06-08 22:10:34 +00:00
[b]Note:[/b] If supporting multiple carets this will not check for any overlap. See [method merge_overlapping_carets].
2021-07-08 17:35:56 +00:00
</description>
</method>
2020-09-11 10:22:10 +00:00
<method name= "set_gutter_clickable" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
<param index= "1" name= "clickable" type= "bool" />
2020-09-11 10:22:10 +00:00
<description >
2021-07-10 13:01:25 +00:00
Sets the gutter as clickable. This will change the mouse cursor to a pointing hand when hovering over the gutter.
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "set_gutter_custom_draw" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "column" type= "int" />
<param index= "1" name= "draw_callback" type= "Callable" />
2020-09-11 10:22:10 +00:00
<description >
2024-02-26 17:02:17 +00:00
Set a custom draw method for the gutter. The callback method must take the following args: [code]line: int, gutter: int, Area: Rect2[/code]. This only works when the gutter type is [constant GUTTER_TYPE_CUSTOM] (see [method set_gutter_type]).
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "set_gutter_draw" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
<param index= "1" name= "draw" type= "bool" />
2020-09-11 10:22:10 +00:00
<description >
2021-07-10 13:01:25 +00:00
Sets whether the gutter should be drawn.
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "set_gutter_name" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
<param index= "1" name= "name" type= "String" />
2020-09-11 10:22:10 +00:00
<description >
2021-07-10 13:01:25 +00:00
Sets the name of the gutter.
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "set_gutter_overwritable" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
<param index= "1" name= "overwritable" type= "bool" />
2020-09-11 10:22:10 +00:00
<description >
2021-07-10 13:01:25 +00:00
Sets the gutter to overwritable. See [method merge_gutters].
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "set_gutter_type" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
<param index= "1" name= "type" type= "int" enum= "TextEdit.GutterType" />
2020-09-11 10:22:10 +00:00
<description >
2024-02-26 17:02:17 +00:00
Sets the type of gutter. Gutters can contain icons, text, or custom visuals. See [enum TextEdit.GutterType] for options.
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "set_gutter_width" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "gutter" type= "int" />
<param index= "1" name= "width" type= "int" />
2020-09-11 10:22:10 +00:00
<description >
2021-07-10 13:01:25 +00:00
Set the width of the gutter.
2020-09-11 10:22:10 +00:00
</description>
</method>
2020-05-11 11:23:39 +00:00
<method name= "set_line" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "new_text" type= "String" />
2017-11-24 08:16:27 +00:00
<description >
2020-05-11 11:23:39 +00:00
Sets the text for a specific line.
2017-11-24 08:16:27 +00:00
</description>
</method>
2021-07-09 16:27:09 +00:00
<method name= "set_line_as_center_visible" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "wrap_index" type= "int" default= "0" />
2021-07-09 16:27:09 +00:00
<description >
2022-08-09 15:19:47 +00:00
Positions the [param wrap_index] of [param line] at the center of the viewport.
2021-07-09 16:27:09 +00:00
</description>
</method>
<method name= "set_line_as_first_visible" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "wrap_index" type= "int" default= "0" />
2021-07-09 16:27:09 +00:00
<description >
2022-08-09 15:19:47 +00:00
Positions the [param wrap_index] of [param line] at the top of the viewport.
2021-07-09 16:27:09 +00:00
</description>
</method>
<method name= "set_line_as_last_visible" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "wrap_index" type= "int" default= "0" />
2021-07-09 16:27:09 +00:00
<description >
2022-08-09 15:19:47 +00:00
Positions the [param wrap_index] of [param line] at the bottom of the viewport.
2021-07-09 16:27:09 +00:00
</description>
</method>
2020-09-10 20:25:00 +00:00
<method name= "set_line_background_color" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "color" type= "Color" />
2020-09-10 20:25:00 +00:00
<description >
Sets the current background color of the line. Set to [code]Color(0, 0, 0, 0)[/code] for no color.
</description>
</method>
2020-09-11 10:22:10 +00:00
<method name= "set_line_gutter_clickable" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "gutter" type= "int" />
<param index= "2" name= "clickable" type= "bool" />
2020-09-11 10:22:10 +00:00
<description >
2022-08-09 15:19:47 +00:00
If [param clickable] is [code]true[/code], makes the [param gutter] on [param line] clickable. See [signal gutter_clicked].
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "set_line_gutter_icon" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "gutter" type= "int" />
<param index= "2" name= "icon" type= "Texture2D" />
2020-09-11 10:22:10 +00:00
<description >
2024-02-26 17:02:17 +00:00
Sets the icon for [param gutter] on [param line] to [param icon]. This only works when the gutter type is [constant GUTTER_TYPE_ICON] (see [method set_gutter_type]).
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "set_line_gutter_item_color" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "gutter" type= "int" />
<param index= "2" name= "color" type= "Color" />
2020-09-11 10:22:10 +00:00
<description >
2022-08-09 15:19:47 +00:00
Sets the color for [param gutter] on [param line] to [param color].
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "set_line_gutter_metadata" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "gutter" type= "int" />
<param index= "2" name= "metadata" type= "Variant" />
2020-09-11 10:22:10 +00:00
<description >
2022-08-09 15:19:47 +00:00
Sets the metadata for [param gutter] on [param line] to [param metadata].
2020-09-11 10:22:10 +00:00
</description>
</method>
<method name= "set_line_gutter_text" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "gutter" type= "int" />
<param index= "2" name= "text" type= "String" />
2020-09-11 10:22:10 +00:00
<description >
2024-02-26 17:02:17 +00:00
Sets the text for [param gutter] on [param line] to [param text]. This only works when the gutter type is [constant GUTTER_TYPE_STRING] (see [method set_gutter_type]).
2020-09-11 10:22:10 +00:00
</description>
</method>
2021-07-09 12:40:05 +00:00
<method name= "set_overtype_mode_enabled" >
2021-07-10 13:01:25 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "enabled" type= "bool" />
2021-07-10 13:01:25 +00:00
<description >
If [code]true[/code], sets the user into overtype mode. When the user types in this mode, it will override existing text.
</description>
</method>
<method name= "set_search_flags" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "flags" type= "int" />
2021-07-09 12:40:05 +00:00
<description >
2022-08-09 15:19:47 +00:00
Sets the search [param flags]. This is used with [method set_search_text] to highlight occurrences of the searched text. Search flags can be specified from the [enum SearchFlags] enum.
2021-07-10 13:01:25 +00:00
</description>
</method>
<method name= "set_search_text" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "search_text" type= "String" />
2021-07-10 13:01:25 +00:00
<description >
Sets the search text. See [method set_search_flags].
2021-07-09 12:40:05 +00:00
</description>
</method>
2020-11-04 14:38:26 +00:00
<method name= "set_selection_mode" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "mode" type= "int" enum= "TextEdit.SelectionMode" />
<param index= "1" name= "line" type= "int" default= "-1" />
<param index= "2" name= "column" type= "int" default= "-1" />
2022-06-08 22:10:34 +00:00
<param index= "3" name= "caret_index" type= "int" default= "0" />
2020-11-04 14:38:26 +00:00
<description >
2021-07-10 13:01:25 +00:00
Sets the current selection mode.
2020-11-04 14:38:26 +00:00
</description>
</method>
2021-06-15 14:05:01 +00:00
<method name= "set_tab_size" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "size" type= "int" />
2021-06-15 14:05:01 +00:00
<description >
2021-07-06 11:22:53 +00:00
Sets the tab size for the [TextEdit] to use.
2021-06-15 14:05:01 +00:00
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "set_tooltip_request_func" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "callback" type= "Callable" />
2021-07-10 13:01:25 +00:00
<description >
2023-02-11 16:18:33 +00:00
Provide custom tooltip text. The callback method must take the following args: [code]hovered_word: String[/code].
2021-07-10 13:01:25 +00:00
</description>
</method>
2022-06-08 22:10:34 +00:00
<method name= "start_action" >
<return type= "void" />
<param index= "0" name= "action" type= "int" enum= "TextEdit.EditAction" />
<description >
2023-04-26 19:36:04 +00:00
Starts an action, will end the current action if [param action] is different.
2022-06-08 22:10:34 +00:00
An action will also end after a call to [method end_action], after [member ProjectSettings.gui/timers/text_edit_idle_detect_sec] is triggered or a new undoable step outside the [method start_action] and [method end_action] calls.
</description>
</method>
2021-07-10 13:01:25 +00:00
<method name= "swap_lines" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "from_line" type= "int" />
<param index= "1" name= "to_line" type= "int" />
2021-07-10 13:01:25 +00:00
<description >
Swaps the two lines.
</description>
</method>
<method name= "tag_saved_version" >
<return type= "void" />
<description >
Tag the current version as saved.
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "undo" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2017-09-12 20:42:36 +00:00
<description >
Perform undo operation.
</description>
</method>
</methods>
<members >
2023-03-12 11:21:00 +00:00
<member name= "autowrap_mode" type= "int" setter= "set_autowrap_mode" getter= "get_autowrap_mode" enum= "TextServer.AutowrapMode" default= "3" >
If [member wrap_mode] is set to [constant LINE_WRAPPING_BOUNDARY], sets text wrapping mode. To see how each mode behaves, see [enum TextServer.AutowrapMode].
</member>
2021-07-08 17:35:56 +00:00
<member name= "caret_blink" type= "bool" setter= "set_caret_blink_enabled" getter= "is_caret_blink_enabled" default= "false" >
2023-04-06 06:04:22 +00:00
If [code]true[/code], makes the caret blink.
2017-09-12 20:42:36 +00:00
</member>
2022-08-13 12:52:35 +00:00
<member name= "caret_blink_interval" type= "float" setter= "set_caret_blink_interval" getter= "get_caret_blink_interval" default= "0.65" >
2023-04-06 06:04:22 +00:00
The interval at which the caret blinks (in seconds).
2017-09-12 20:42:36 +00:00
</member>
2023-02-07 23:02:48 +00:00
<member name= "caret_draw_when_editable_disabled" type= "bool" setter= "set_draw_caret_when_editable_disabled" getter= "is_drawing_caret_when_editable_disabled" default= "false" >
If [code]true[/code], caret will be visible when [member editable] is disabled.
</member>
2023-08-15 08:42:40 +00:00
<member name= "caret_mid_grapheme" type= "bool" setter= "set_caret_mid_grapheme_enabled" getter= "is_caret_mid_grapheme_enabled" default= "false" >
2020-08-12 11:49:10 +00:00
Allow moving caret, selecting and removing the individual composite character components.
2021-10-05 12:24:34 +00:00
[b]Note:[/b] [kbd]Backspace[/kbd] is always removing individual composite character components.
2020-08-12 11:49:10 +00:00
</member>
2021-07-08 17:35:56 +00:00
<member name= "caret_move_on_right_click" type= "bool" setter= "set_move_caret_on_right_click_enabled" getter= "is_move_caret_on_right_click_enabled" default= "true" >
If [code]true[/code], a right-click moves the caret at the mouse position before displaying the context menu.
2024-01-15 14:23:17 +00:00
If [code]false[/code], the context menu ignores mouse location.
2017-09-12 20:42:36 +00:00
</member>
2022-06-08 22:10:34 +00:00
<member name= "caret_multiple" type= "bool" setter= "set_multiple_carets_enabled" getter= "is_multiple_carets_enabled" default= "true" >
Sets if multiple carets are allowed.
</member>
2021-07-08 17:35:56 +00:00
<member name= "caret_type" type= "int" setter= "set_caret_type" getter= "get_caret_type" enum= "TextEdit.CaretType" default= "0" >
Set the type of caret to draw.
</member>
2019-06-29 10:38:01 +00:00
<member name= "context_menu_enabled" type= "bool" setter= "set_context_menu_enabled" getter= "is_context_menu_enabled" default= "true" >
2019-06-21 23:04:47 +00:00
If [code]true[/code], a right-click displays the context menu.
2017-11-13 08:24:36 +00:00
</member>
2021-10-21 21:02:46 +00:00
<member name= "deselect_on_focus_loss_enabled" type= "bool" setter= "set_deselect_on_focus_loss_enabled" getter= "is_deselect_on_focus_loss_enabled" default= "true" >
If [code]true[/code], the selected text will be deselected when focus is lost.
</member>
2022-06-19 14:55:13 +00:00
<member name= "drag_and_drop_selection_enabled" type= "bool" setter= "set_drag_and_drop_selection_enabled" getter= "is_drag_and_drop_selection_enabled" default= "true" >
If [code]true[/code], allow drag and drop of selected text.
</member>
2020-08-12 11:49:10 +00:00
<member name= "draw_control_chars" type= "bool" setter= "set_draw_control_chars" getter= "get_draw_control_chars" default= "false" >
If [code]true[/code], control characters are displayed.
</member>
2019-06-29 10:38:01 +00:00
<member name= "draw_spaces" type= "bool" setter= "set_draw_spaces" getter= "is_drawing_spaces" default= "false" >
2019-05-01 09:31:10 +00:00
If [code]true[/code], the "space" character will have a visible representation.
</member>
2019-06-29 10:38:01 +00:00
<member name= "draw_tabs" type= "bool" setter= "set_draw_tabs" getter= "is_drawing_tabs" default= "false" >
2019-05-21 11:26:37 +00:00
If [code]true[/code], the "tab" character will have a visible representation.
</member>
2024-02-21 17:51:08 +00:00
<member name= "editable" type= "bool" setter= "set_editable" getter= "is_editable" default= "true" keywords= "readonly, disabled, enabled" >
2021-07-09 13:05:52 +00:00
If [code]false[/code], existing text cannot be modified and new text cannot be added.
</member>
2021-12-02 19:38:49 +00:00
<member name= "focus_mode" type= "int" setter= "set_focus_mode" getter= "get_focus_mode" overrides= "Control" enum= "Control.FocusMode" default= "2" />
2019-06-29 10:38:01 +00:00
<member name= "highlight_all_occurrences" type= "bool" setter= "set_highlight_all_occurrences" getter= "is_highlight_all_occurrences_enabled" default= "false" >
2019-06-13 09:12:52 +00:00
If [code]true[/code], all occurrences of the selected text will be highlighted.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "highlight_current_line" type= "bool" setter= "set_highlight_current_line" getter= "is_highlight_current_line_enabled" default= "false" >
2018-12-20 12:46:54 +00:00
If [code]true[/code], the line containing the cursor is highlighted.
2017-10-24 17:22:37 +00:00
</member>
2024-02-19 11:41:12 +00:00
<member name= "indent_wrapped_lines" type= "bool" setter= "set_indent_wrapped_lines" getter= "is_indent_wrapped_lines" default= "false" >
If [code]true[/code], all wrapped lines are indented to the same amount as the unwrapped line.
</member>
2020-08-12 11:49:10 +00:00
<member name= "language" type= "String" setter= "set_language" getter= "get_language" default= """" >
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
</member>
2021-10-12 07:43:50 +00:00
<member name= "middle_mouse_paste_enabled" type= "bool" setter= "set_middle_mouse_paste_enabled" getter= "is_middle_mouse_paste_enabled" default= "true" >
If [code]false[/code], using middle mouse button to paste clipboard will be disabled.
[b]Note:[/b] This method is only implemented on Linux.
</member>
2021-10-08 21:26:13 +00:00
<member name= "minimap_draw" type= "bool" setter= "set_draw_minimap" getter= "is_drawing_minimap" default= "false" >
2020-07-03 12:42:43 +00:00
If [code]true[/code], a minimap is shown, providing an outline of your source code.
2019-08-22 12:49:30 +00:00
</member>
<member name= "minimap_width" type= "int" setter= "set_minimap_width" getter= "get_minimap_width" default= "80" >
2020-07-03 12:42:43 +00:00
The width, in pixels, of the minimap.
2019-08-22 12:49:30 +00:00
</member>
2021-12-02 19:38:49 +00:00
<member name= "mouse_default_cursor_shape" type= "int" setter= "set_default_cursor_shape" getter= "get_default_cursor_shape" overrides= "Control" enum= "Control.CursorShape" default= "1" />
2022-01-23 20:07:35 +00:00
<member name= "placeholder_text" type= "String" setter= "set_placeholder" getter= "get_placeholder" default= """" >
Text shown when the [TextEdit] is empty. It is [b]not[/b] the [TextEdit]'s default value (see [member text]).
</member>
2022-06-20 23:19:54 +00:00
<member name= "scroll_fit_content_height" type= "bool" setter= "set_fit_content_height_enabled" getter= "is_fit_content_height_enabled" default= "false" >
If [code]true[/code], [TextEdit] will disable vertical scroll and fit minimum height to the number of visible lines.
</member>
2020-01-12 13:30:21 +00:00
<member name= "scroll_horizontal" type= "int" setter= "set_h_scroll" getter= "get_h_scroll" default= "0" >
2021-05-09 23:27:54 +00:00
If there is a horizontal scrollbar, this determines the current horizontal scroll value in pixels.
2020-01-12 13:30:21 +00:00
</member>
2021-07-09 16:27:09 +00:00
<member name= "scroll_past_end_of_file" type= "bool" setter= "set_scroll_past_end_of_file_enabled" getter= "is_scroll_past_end_of_file_enabled" default= "false" >
Allow scrolling past the last line into "virtual" space.
</member>
2022-06-20 23:19:54 +00:00
<member name= "scroll_smooth" type= "bool" setter= "set_smooth_scroll_enabled" getter= "is_smooth_scroll_enabled" default= "false" >
2023-10-03 21:51:48 +00:00
Scroll smoothly over the text rather than jumping to the next location.
2021-07-10 13:01:25 +00:00
</member>
<member name= "scroll_v_scroll_speed" type= "float" setter= "set_v_scroll_speed" getter= "get_v_scroll_speed" default= "80.0" >
Sets the scroll speed with the minimap or when [member scroll_smooth] is enabled.
</member>
2020-01-12 13:30:21 +00:00
<member name= "scroll_vertical" type= "float" setter= "set_v_scroll" getter= "get_v_scroll" default= "0.0" >
2021-05-09 23:27:54 +00:00
If there is a vertical scrollbar, this determines the current vertical scroll value in line numbers, starting at 0 for the top line.
2020-01-12 13:30:21 +00:00
</member>
2019-09-24 09:44:48 +00:00
<member name= "selecting_enabled" type= "bool" setter= "set_selecting_enabled" getter= "is_selecting_enabled" default= "true" >
2020-07-03 11:24:40 +00:00
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.
2019-09-24 09:44:48 +00:00
</member>
<member name= "shortcut_keys_enabled" type= "bool" setter= "set_shortcut_keys_enabled" getter= "is_shortcut_keys_enabled" default= "true" >
2020-07-03 08:03:56 +00:00
If [code]true[/code], shortcut keys for context menu items are enabled, even if the context menu is disabled.
2019-09-24 09:44:48 +00:00
</member>
2022-04-19 10:27:18 +00:00
<member name= "structured_text_bidi_override" type= "int" setter= "set_structured_text_bidi_override" getter= "get_structured_text_bidi_override" enum= "TextServer.StructuredTextParser" default= "0" >
2020-08-12 11:49:10 +00:00
Set BiDi algorithm override for the structured text.
</member>
2019-09-24 17:45:03 +00:00
<member name= "structured_text_bidi_override_options" type= "Array" setter= "set_structured_text_bidi_override_options" getter= "get_structured_text_bidi_override_options" default= "[]" >
2020-08-12 11:49:10 +00:00
Set additional options for BiDi override.
</member>
2020-07-15 06:43:21 +00:00
<member name= "syntax_highlighter" type= "SyntaxHighlighter" setter= "set_syntax_highlighter" getter= "get_syntax_highlighter" >
2020-10-11 16:07:33 +00:00
Sets the [SyntaxHighlighter] to use.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "text" type= "String" setter= "set_text" getter= "get_text" default= """" >
2017-11-13 08:24:36 +00:00
String value of the [TextEdit].
</member>
2020-08-12 11:49:10 +00:00
<member name= "text_direction" type= "int" setter= "set_text_direction" getter= "get_text_direction" enum= "Control.TextDirection" default= "0" >
Base text writing direction.
</member>
2020-08-09 09:06:36 +00:00
<member name= "virtual_keyboard_enabled" type= "bool" setter= "set_virtual_keyboard_enabled" getter= "is_virtual_keyboard_enabled" default= "true" >
If [code]true[/code], the native virtual keyboard is shown when focused on platforms that support it.
</member>
2021-07-09 10:52:49 +00:00
<member name= "wrap_mode" type= "int" setter= "set_line_wrapping_mode" getter= "get_line_wrapping_mode" enum= "TextEdit.LineWrappingMode" default= "0" >
Sets the line wrapping mode to use.
2017-09-12 20:42:36 +00:00
</member>
</members>
<signals >
2021-07-08 17:35:56 +00:00
<signal name= "caret_changed" >
2017-09-12 20:42:36 +00:00
<description >
2021-07-08 17:35:56 +00:00
Emitted when the caret changes position.
2017-09-12 20:42:36 +00:00
</description>
</signal>
2020-09-11 10:22:10 +00:00
<signal name= "gutter_added" >
2017-09-12 20:42:36 +00:00
<description >
2021-07-10 13:01:25 +00:00
Emitted when a gutter is added.
2017-09-12 20:42:36 +00:00
</description>
</signal>
2020-09-11 10:22:10 +00:00
<signal name= "gutter_clicked" >
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "gutter" type= "int" />
2019-04-23 19:39:09 +00:00
<description >
2021-07-10 13:01:25 +00:00
Emitted when a gutter is clicked.
2019-04-23 19:39:09 +00:00
</description>
</signal>
2020-09-11 10:22:10 +00:00
<signal name= "gutter_removed" >
<description >
2021-07-10 13:01:25 +00:00
Emitted when a gutter is removed.
2020-09-11 10:22:10 +00:00
</description>
</signal>
<signal name= "lines_edited_from" >
2022-08-06 18:11:48 +00:00
<param index= "0" name= "from_line" type= "int" />
<param index= "1" name= "to_line" type= "int" />
2020-07-15 06:43:21 +00:00
<description >
2021-07-10 13:01:25 +00:00
Emitted immediately when the text changes.
2023-07-11 22:33:49 +00:00
When text is added [param from_line] will be less than [param to_line]. On a remove [param to_line] will be less than [param from_line].
2020-07-15 06:43:21 +00:00
</description>
</signal>
2017-09-12 20:42:36 +00:00
<signal name= "text_changed" >
<description >
Emitted when the text changes.
</description>
</signal>
2021-07-11 16:07:29 +00:00
<signal name= "text_set" >
<description >
Emitted when [method clear] is called or [member text] is set.
</description>
</signal>
2017-09-12 20:42:36 +00:00
</signals>
<constants >
2017-11-24 22:16:30 +00:00
<constant name= "MENU_CUT" value= "0" enum= "MenuItems" >
2019-11-08 07:33:48 +00:00
Cuts (copies and clears) the selected text.
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "MENU_COPY" value= "1" enum= "MenuItems" >
2017-12-20 01:36:47 +00:00
Copies the selected text.
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "MENU_PASTE" value= "2" enum= "MenuItems" >
2017-12-20 01:36:47 +00:00
Pastes the clipboard text over the selected text (or at the cursor's position).
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "MENU_CLEAR" value= "3" enum= "MenuItems" >
2017-12-20 01:36:47 +00:00
Erases the whole [TextEdit] text.
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "MENU_SELECT_ALL" value= "4" enum= "MenuItems" >
2017-12-20 01:36:47 +00:00
Selects the whole [TextEdit] text.
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "MENU_UNDO" value= "5" enum= "MenuItems" >
2017-12-20 01:36:47 +00:00
Undoes the previous action.
2017-09-12 20:42:36 +00:00
</constant>
2018-12-04 20:57:07 +00:00
<constant name= "MENU_REDO" value= "6" enum= "MenuItems" >
2019-06-13 09:12:52 +00:00
Redoes the previous action.
2018-12-04 20:57:07 +00:00
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_SUBMENU_TEXT_DIR" value= "7" enum= "MenuItems" >
ID of "Text Writing Direction" submenu.
</constant>
<constant name= "MENU_DIR_INHERITED" value= "8" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Sets text direction to inherited.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_DIR_AUTO" value= "9" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Sets text direction to automatic.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_DIR_LTR" value= "10" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Sets text direction to left-to-right.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_DIR_RTL" value= "11" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Sets text direction to right-to-left.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_DISPLAY_UCC" value= "12" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Toggles control character display.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_SUBMENU_INSERT_UCC" value= "13" enum= "MenuItems" >
ID of "Insert Control Character" submenu.
</constant>
<constant name= "MENU_INSERT_LRM" value= "14" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts left-to-right mark (LRM) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_RLM" value= "15" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts right-to-left mark (RLM) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_LRE" value= "16" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts start of left-to-right embedding (LRE) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_RLE" value= "17" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts start of right-to-left embedding (RLE) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_LRO" value= "18" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts start of left-to-right override (LRO) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_RLO" value= "19" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts start of right-to-left override (RLO) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_PDF" value= "20" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts pop direction formatting (PDF) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_ALM" value= "21" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts Arabic letter mark (ALM) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_LRI" value= "22" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts left-to-right isolate (LRI) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_RLI" value= "23" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts right-to-left isolate (RLI) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_FSI" value= "24" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts first strong isolate (FSI) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_PDI" value= "25" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts pop direction isolate (PDI) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_ZWJ" value= "26" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts zero width joiner (ZWJ) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_ZWNJ" value= "27" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts zero width non-joiner (ZWNJ) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_WJ" value= "28" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts word joiner (WJ) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_INSERT_SHY" value= "29" enum= "MenuItems" >
2020-08-12 11:49:10 +00:00
Inserts soft hyphen (SHY) character.
</constant>
2023-01-26 17:59:41 +00:00
<constant name= "MENU_MAX" value= "30" enum= "MenuItems" >
2019-06-13 09:12:52 +00:00
Represents the size of the [enum MenuItems] enum.
2017-09-12 20:42:36 +00:00
</constant>
2022-06-08 22:10:34 +00:00
<constant name= "ACTION_NONE" value= "0" enum= "EditAction" >
No current action.
</constant>
<constant name= "ACTION_TYPING" value= "1" enum= "EditAction" >
A typing action.
</constant>
<constant name= "ACTION_BACKSPACE" value= "2" enum= "EditAction" >
A backwards delete action.
</constant>
<constant name= "ACTION_DELETE" value= "3" enum= "EditAction" >
A forward delete action.
</constant>
2021-07-10 13:01:25 +00:00
<constant name= "SEARCH_MATCH_CASE" value= "1" enum= "SearchFlags" >
Match case when searching.
</constant>
<constant name= "SEARCH_WHOLE_WORDS" value= "2" enum= "SearchFlags" >
Match whole words when searching.
</constant>
<constant name= "SEARCH_BACKWARDS" value= "4" enum= "SearchFlags" >
Search from end to beginning.
</constant>
<constant name= "CARET_TYPE_LINE" value= "0" enum= "CaretType" >
Vertical line caret.
</constant>
<constant name= "CARET_TYPE_BLOCK" value= "1" enum= "CaretType" >
Block caret.
</constant>
<constant name= "SELECTION_MODE_NONE" value= "0" enum= "SelectionMode" >
Not selecting.
</constant>
<constant name= "SELECTION_MODE_SHIFT" value= "1" enum= "SelectionMode" >
Select as if [code]shift[/code] is pressed.
</constant>
<constant name= "SELECTION_MODE_POINTER" value= "2" enum= "SelectionMode" >
Select single characters as if the user single clicked.
</constant>
<constant name= "SELECTION_MODE_WORD" value= "3" enum= "SelectionMode" >
Select whole words as if the user double clicked.
</constant>
<constant name= "SELECTION_MODE_LINE" value= "4" enum= "SelectionMode" >
2023-03-08 22:00:27 +00:00
Select whole lines as if the user triple clicked.
2021-07-10 13:01:25 +00:00
</constant>
<constant name= "LINE_WRAPPING_NONE" value= "0" enum= "LineWrappingMode" >
Line wrapping is disabled.
</constant>
<constant name= "LINE_WRAPPING_BOUNDARY" value= "1" enum= "LineWrappingMode" >
Line wrapping occurs at the control boundary, beyond what would normally be visible.
</constant>
<constant name= "GUTTER_TYPE_STRING" value= "0" enum= "GutterType" >
2024-02-26 17:02:17 +00:00
When a gutter is set to string using [method set_gutter_type], it is used to contain text set via the [method set_line_gutter_text] method.
2021-07-10 13:01:25 +00:00
</constant>
<constant name= "GUTTER_TYPE_ICON" value= "1" enum= "GutterType" >
2024-02-26 17:02:17 +00:00
When a gutter is set to icon using [method set_gutter_type], it is used to contain an icon set via the [method set_line_gutter_icon] method.
2021-07-10 13:01:25 +00:00
</constant>
<constant name= "GUTTER_TYPE_CUSTOM" value= "2" enum= "GutterType" >
2024-02-26 17:02:17 +00:00
When a gutter is set to custom using [method set_gutter_type], it is used to contain custom visuals controlled by a callback method set via the [method set_gutter_custom_draw] method.
2021-07-10 13:01:25 +00:00
</constant>
2017-09-12 20:42:36 +00:00
</constants>
<theme_items >
2021-08-04 16:54:41 +00:00
<theme_item name= "background_color" data_type= "color" type= "Color" default= "Color(0, 0, 0, 0)" >
2020-10-11 16:07:33 +00:00
Sets the background [Color] of this [TextEdit].
2017-09-12 20:42:36 +00:00
</theme_item>
2021-08-04 16:54:41 +00:00
<theme_item name= "caret_background_color" data_type= "color" type= "Color" default= "Color(0, 0, 0, 1)" >
2021-07-10 13:01:25 +00:00
[Color] of the text behind the caret when using a block caret.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-12-30 16:22:06 +00:00
<theme_item name= "caret_color" data_type= "color" type= "Color" default= "Color(0.875, 0.875, 0.875, 1)" >
2021-11-13 22:06:47 +00:00
[Color] of the caret. This can be set to a fully transparent color to hide the caret entirely.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-08-04 16:54:41 +00:00
<theme_item name= "current_line_color" data_type= "color" type= "Color" default= "Color(0.25, 0.25, 0.26, 0.8)" >
Background [Color] of the line containing the caret.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-12-30 16:22:06 +00:00
<theme_item name= "font_color" data_type= "color" type= "Color" default= "Color(0.875, 0.875, 0.875, 1)" >
2019-06-25 10:57:35 +00:00
Sets the font [Color].
2017-09-12 20:42:36 +00:00
</theme_item>
2021-11-05 19:50:01 +00:00
<theme_item name= "font_outline_color" data_type= "color" type= "Color" default= "Color(0, 0, 0, 1)" >
2020-12-25 21:45:28 +00:00
The tint of text outline of the [TextEdit].
</theme_item>
2022-01-30 17:56:23 +00:00
<theme_item name= "font_placeholder_color" data_type= "color" type= "Color" default= "Color(0.875, 0.875, 0.875, 0.6)" >
Font color for [member placeholder_text].
</theme_item>
2021-12-30 16:22:06 +00:00
<theme_item name= "font_readonly_color" data_type= "color" type= "Color" default= "Color(0.875, 0.875, 0.875, 0.5)" >
2021-07-10 13:01:25 +00:00
Sets the font [Color] when [member editable] is disabled.
2019-06-26 14:02:47 +00:00
</theme_item>
2022-10-25 22:46:06 +00:00
<theme_item name= "font_selected_color" data_type= "color" type= "Color" default= "Color(0, 0, 0, 0)" >
Sets the [Color] of the selected text. If equal to [code]Color(0, 0, 0, 0)[/code], it will be ignored.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-09-21 19:07:12 +00:00
<theme_item name= "search_result_border_color" data_type= "color" type= "Color" default= "Color(0.3, 0.3, 0.3, 0.4)" >
[Color] of the border around text that matches the search query.
</theme_item>
<theme_item name= "search_result_color" data_type= "color" type= "Color" default= "Color(0.3, 0.3, 0.3, 1)" >
[Color] behind the text that matches the search query.
</theme_item>
2021-12-30 16:22:06 +00:00
<theme_item name= "selection_color" data_type= "color" type= "Color" default= "Color(0.5, 0.5, 0.5, 1)" >
2019-06-25 10:57:35 +00:00
Sets the highlight [Color] of text selections.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-12-30 16:22:06 +00:00
<theme_item name= "word_highlighted_color" data_type= "color" type= "Color" default= "Color(0.5, 0.5, 0.5, 0.25)" >
2021-12-01 18:02:20 +00:00
Sets the highlight [Color] of multiple occurrences. [member highlight_all_occurrences] has to be enabled.
</theme_item>
2021-11-13 22:06:47 +00:00
<theme_item name= "caret_width" data_type= "constant" type= "int" default= "1" >
The caret's width in pixels. Greater values can be used to improve accessibility by ensuring the caret is easily visible, or to ensure consistency with a large font size. If set to [code]0[/code] or lower, the caret width is automatically set to 1 pixel and multiplied by the display scaling factor.
</theme_item>
2021-12-01 18:02:20 +00:00
<theme_item name= "line_spacing" data_type= "constant" type= "int" default= "4" >
Sets the spacing between the lines.
</theme_item>
<theme_item name= "outline_size" data_type= "constant" type= "int" default= "0" >
The size of the text outline.
2022-12-19 16:15:44 +00:00
[b]Note:[/b] If using a font with [member FontFile.multichannel_signed_distance_field] enabled, its [member FontFile.msdf_pixel_range] must be set to at least [i]twice[/i] the value of [theme_item outline_size] for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
2021-12-01 18:02:20 +00:00
</theme_item>
<theme_item name= "font" data_type= "font" type= "Font" >
Sets the default [Font].
</theme_item>
<theme_item name= "font_size" data_type= "font_size" type= "int" >
Sets default font size.
</theme_item>
2021-08-04 16:54:41 +00:00
<theme_item name= "space" data_type= "icon" type= "Texture2D" >
2020-08-12 11:49:10 +00:00
Sets a custom [Texture2D] for space text characters.
2019-05-21 11:26:37 +00:00
</theme_item>
2021-08-04 16:54:41 +00:00
<theme_item name= "tab" data_type= "icon" type= "Texture2D" >
2020-02-12 08:59:06 +00:00
Sets a custom [Texture2D] for tab text characters.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-12-01 18:02:20 +00:00
<theme_item name= "focus" data_type= "style" type= "StyleBox" >
2023-10-02 18:11:43 +00:00
Sets the [StyleBox] when in focus. The [theme_item focus] [StyleBox] is displayed [i]over[/i] the base [StyleBox], so a partially transparent [StyleBox] should be used to ensure the base [StyleBox] remains visible. A [StyleBox] that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a [StyleBoxEmpty] resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
2021-12-01 18:02:20 +00:00
</theme_item>
<theme_item name= "normal" data_type= "style" type= "StyleBox" >
Sets the [StyleBox] of this [TextEdit].
</theme_item>
2024-02-21 17:51:08 +00:00
<theme_item name= "read_only" data_type= "style" type= "StyleBox" keywords= "enabled, disabled, editable" >
2021-12-01 18:02:20 +00:00
Sets the [StyleBox] of this [TextEdit] when [member editable] is disabled.
2017-09-12 20:42:36 +00:00
</theme_item>
</theme_items>
</class>