Files
godot-docs/classes/class_textedit.rst
2020-01-21 09:28:25 +01:00

891 lines
48 KiB
ReStructuredText

:github_url: hide
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the TextEdit.xml source instead.
.. The source is found in doc/classes or modules/<name>/doc_classes.
.. _class_TextEdit:
TextEdit
========
**Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**Category:** Core
Brief Description
-----------------
Multiline text editing control.
Properties
----------
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`breakpoint_gutter<class_TextEdit_property_breakpoint_gutter>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`caret_blink<class_TextEdit_property_caret_blink>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`caret_blink_speed<class_TextEdit_property_caret_blink_speed>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`caret_block_mode<class_TextEdit_property_caret_block_mode>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`caret_moving_by_right_click<class_TextEdit_property_caret_moving_by_right_click>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`context_menu_enabled<class_TextEdit_property_context_menu_enabled>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`hiding_enabled<class_TextEdit_property_hiding_enabled>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`highlight_all_occurrences<class_TextEdit_property_highlight_all_occurrences>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`highlight_current_line<class_TextEdit_property_highlight_current_line>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`override_selected_font_color<class_TextEdit_property_override_selected_font_color>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`readonly<class_TextEdit_property_readonly>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`show_line_numbers<class_TextEdit_property_show_line_numbers>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`smooth_scrolling<class_TextEdit_property_smooth_scrolling>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`syntax_highlighting<class_TextEdit_property_syntax_highlighting>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`text<class_TextEdit_property_text>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`v_scroll_speed<class_TextEdit_property_v_scroll_speed>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`wrap_enabled<class_TextEdit_property_wrap_enabled>` |
+-----------------------------+-------------------------------------------------------------------------------------------+
Methods
-------
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_color_region<class_TextEdit_method_add_color_region>` **(** :ref:`String<class_String>` begin_key, :ref:`String<class_String>` end_key, :ref:`Color<class_Color>` color, :ref:`bool<class_bool>` line_only=false **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_keyword_color<class_TextEdit_method_add_keyword_color>` **(** :ref:`String<class_String>` keyword, :ref:`Color<class_Color>` color **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`can_fold<class_TextEdit_method_can_fold>` **(** :ref:`int<class_int>` line **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`clear_colors<class_TextEdit_method_clear_colors>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`clear_undo_history<class_TextEdit_method_clear_undo_history>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`copy<class_TextEdit_method_copy>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`cursor_get_column<class_TextEdit_method_cursor_get_column>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`cursor_get_line<class_TextEdit_method_cursor_get_line>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`cursor_set_column<class_TextEdit_method_cursor_set_column>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` adjust_viewport=true **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`cursor_set_line<class_TextEdit_method_cursor_set_line>` **(** :ref:`int<class_int>` line, :ref:`bool<class_bool>` adjust_viewport=true, :ref:`bool<class_bool>` can_be_hidden=true, :ref:`int<class_int>` wrap_index=0 **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`cut<class_TextEdit_method_cut>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`deselect<class_TextEdit_method_deselect>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`fold_all_lines<class_TextEdit_method_fold_all_lines>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`fold_line<class_TextEdit_method_fold_line>` **(** :ref:`int<class_int>` line **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`get_breakpoints<class_TextEdit_method_get_breakpoints>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Color<class_Color>` | :ref:`get_keyword_color<class_TextEdit_method_get_keyword_color>` **(** :ref:`String<class_String>` keyword **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_line<class_TextEdit_method_get_line>` **(** :ref:`int<class_int>` line **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_line_count<class_TextEdit_method_get_line_count>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PopupMenu<class_PopupMenu>` | :ref:`get_menu<class_TextEdit_method_get_menu>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_selection_from_column<class_TextEdit_method_get_selection_from_column>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_selection_from_line<class_TextEdit_method_get_selection_from_line>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_selection_text<class_TextEdit_method_get_selection_text>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_selection_to_column<class_TextEdit_method_get_selection_to_column>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_selection_to_line<class_TextEdit_method_get_selection_to_line>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_word_under_cursor<class_TextEdit_method_get_word_under_cursor>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`has_keyword_color<class_TextEdit_method_has_keyword_color>` **(** :ref:`String<class_String>` keyword **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`insert_text_at_cursor<class_TextEdit_method_insert_text_at_cursor>` **(** :ref:`String<class_String>` text **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_folded<class_TextEdit_method_is_folded>` **(** :ref:`int<class_int>` line **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_line_hidden<class_TextEdit_method_is_line_hidden>` **(** :ref:`int<class_int>` line **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_selection_active<class_TextEdit_method_is_selection_active>` **(** **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`menu_option<class_TextEdit_method_menu_option>` **(** :ref:`int<class_int>` option **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`paste<class_TextEdit_method_paste>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`redo<class_TextEdit_method_redo>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`remove_breakpoints<class_TextEdit_method_remove_breakpoints>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`search<class_TextEdit_method_search>` **(** :ref:`String<class_String>` key, :ref:`int<class_int>` flags, :ref:`int<class_int>` from_line, :ref:`int<class_int>` from_column **)** const |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`select<class_TextEdit_method_select>` **(** :ref:`int<class_int>` from_line, :ref:`int<class_int>` from_column, :ref:`int<class_int>` to_line, :ref:`int<class_int>` to_column **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`select_all<class_TextEdit_method_select_all>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_line_as_hidden<class_TextEdit_method_set_line_as_hidden>` **(** :ref:`int<class_int>` line, :ref:`bool<class_bool>` enable **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`toggle_fold_line<class_TextEdit_method_toggle_fold_line>` **(** :ref:`int<class_int>` line **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`undo<class_TextEdit_method_undo>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`unfold_line<class_TextEdit_method_unfold_line>` **(** :ref:`int<class_int>` line **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`unhide_all_lines<class_TextEdit_method_unhide_all_lines>` **(** **)** |
+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Theme Properties
----------------
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | background_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | brace_mismatch_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | breakpoint_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | caret_background_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | caret_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | code_folding_color |
+---------------------------------+-----------------------------+
| :ref:`StyleBox<class_StyleBox>` | completion |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | completion_background_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | completion_existing_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | completion_font_color |
+---------------------------------+-----------------------------+
| :ref:`int<class_int>` | completion_lines |
+---------------------------------+-----------------------------+
| :ref:`int<class_int>` | completion_max_width |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | completion_scroll_color |
+---------------------------------+-----------------------------+
| :ref:`int<class_int>` | completion_scroll_width |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | completion_selected_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | current_line_color |
+---------------------------------+-----------------------------+
| :ref:`StyleBox<class_StyleBox>` | focus |
+---------------------------------+-----------------------------+
| :ref:`Font<class_Font>` | font |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | font_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | font_color_selected |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | function_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | line_number_color |
+---------------------------------+-----------------------------+
| :ref:`int<class_int>` | line_spacing |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | mark_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | member_variable_color |
+---------------------------------+-----------------------------+
| :ref:`StyleBox<class_StyleBox>` | normal |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | number_color |
+---------------------------------+-----------------------------+
| :ref:`StyleBox<class_StyleBox>` | read_only |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | safe_line_number_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | selection_color |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | symbol_color |
+---------------------------------+-----------------------------+
| :ref:`Texture<class_Texture>` | tab |
+---------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | word_highlighted_color |
+---------------------------------+-----------------------------+
Signals
-------
.. _class_TextEdit_signal_breakpoint_toggled:
- **breakpoint_toggled** **(** :ref:`int<class_int>` row **)**
Emitted when a breakpoint is placed via the breakpoint gutter.
----
.. _class_TextEdit_signal_cursor_changed:
- **cursor_changed** **(** **)**
Emitted when the cursor changes.
----
.. _class_TextEdit_signal_request_completion:
- **request_completion** **(** **)**
----
.. _class_TextEdit_signal_symbol_lookup:
- **symbol_lookup** **(** :ref:`String<class_String>` symbol, :ref:`int<class_int>` row, :ref:`int<class_int>` column **)**
----
.. _class_TextEdit_signal_text_changed:
- **text_changed** **(** **)**
Emitted when the text changes.
Enumerations
------------
.. _enum_TextEdit_SearchFlags:
.. _class_TextEdit_constant_SEARCH_MATCH_CASE:
.. _class_TextEdit_constant_SEARCH_WHOLE_WORDS:
.. _class_TextEdit_constant_SEARCH_BACKWARDS:
enum **SearchFlags**:
- **SEARCH_MATCH_CASE** = **1** --- Match case when searching.
- **SEARCH_WHOLE_WORDS** = **2** --- Match whole words when searching.
- **SEARCH_BACKWARDS** = **4** --- Search from end to beginning.
----
.. _enum_TextEdit_MenuItems:
.. _class_TextEdit_constant_MENU_CUT:
.. _class_TextEdit_constant_MENU_COPY:
.. _class_TextEdit_constant_MENU_PASTE:
.. _class_TextEdit_constant_MENU_CLEAR:
.. _class_TextEdit_constant_MENU_SELECT_ALL:
.. _class_TextEdit_constant_MENU_UNDO:
.. _class_TextEdit_constant_MENU_REDO:
.. _class_TextEdit_constant_MENU_MAX:
enum **MenuItems**:
- **MENU_CUT** = **0** --- Cuts (Copies and clears) the selected text.
- **MENU_COPY** = **1** --- Copies the selected text.
- **MENU_PASTE** = **2** --- Pastes the clipboard text over the selected text (or at the cursor's position).
- **MENU_CLEAR** = **3** --- Erases the whole :ref:`TextEdit<class_TextEdit>` text.
- **MENU_SELECT_ALL** = **4** --- Selects the whole :ref:`TextEdit<class_TextEdit>` text.
- **MENU_UNDO** = **5** --- Undoes the previous action.
- **MENU_REDO** = **6** --- Redoes the previous action.
- **MENU_MAX** = **7** --- Represents the size of the :ref:`MenuItems<enum_TextEdit_MenuItems>` enum.
Description
-----------
TextEdit is meant for editing large, multiline text. It also has facilities for editing code, such as syntax highlighting support and multiple levels of undo/redo.
Property Descriptions
---------------------
.. _class_TextEdit_property_breakpoint_gutter:
- :ref:`bool<class_bool>` **breakpoint_gutter**
+----------+--------------------------------------+
| *Setter* | set_breakpoint_gutter_enabled(value) |
+----------+--------------------------------------+
| *Getter* | is_breakpoint_gutter_enabled() |
+----------+--------------------------------------+
If ``true``, the breakpoint gutter is visible.
----
.. _class_TextEdit_property_caret_blink:
- :ref:`bool<class_bool>` **caret_blink**
+----------+---------------------------------+
| *Setter* | cursor_set_blink_enabled(value) |
+----------+---------------------------------+
| *Getter* | cursor_get_blink_enabled() |
+----------+---------------------------------+
If ``true``, the caret (visual cursor) blinks.
----
.. _class_TextEdit_property_caret_blink_speed:
- :ref:`float<class_float>` **caret_blink_speed**
+----------+-------------------------------+
| *Setter* | cursor_set_blink_speed(value) |
+----------+-------------------------------+
| *Getter* | cursor_get_blink_speed() |
+----------+-------------------------------+
Duration (in seconds) of a caret's blinking cycle.
----
.. _class_TextEdit_property_caret_block_mode:
- :ref:`bool<class_bool>` **caret_block_mode**
+----------+------------------------------+
| *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.
----
.. _class_TextEdit_property_caret_moving_by_right_click:
- :ref:`bool<class_bool>` **caret_moving_by_right_click**
+----------+------------------------------------+
| *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.
----
.. _class_TextEdit_property_context_menu_enabled:
- :ref:`bool<class_bool>` **context_menu_enabled**
+----------+---------------------------------+
| *Setter* | set_context_menu_enabled(value) |
+----------+---------------------------------+
| *Getter* | is_context_menu_enabled() |
+----------+---------------------------------+
If ``true``, a right click displays the context menu.
----
.. _class_TextEdit_property_hiding_enabled:
- :ref:`int<class_int>` **hiding_enabled**
+----------+---------------------------+
| *Setter* | set_hiding_enabled(value) |
+----------+---------------------------+
| *Getter* | is_hiding_enabled() |
+----------+---------------------------+
----
.. _class_TextEdit_property_highlight_all_occurrences:
- :ref:`bool<class_bool>` **highlight_all_occurrences**
+----------+----------------------------------------+
| *Setter* | set_highlight_all_occurrences(value) |
+----------+----------------------------------------+
| *Getter* | is_highlight_all_occurrences_enabled() |
+----------+----------------------------------------+
If ``true``, all occurrences of the selected text will be highlighted.
----
.. _class_TextEdit_property_highlight_current_line:
- :ref:`bool<class_bool>` **highlight_current_line**
+----------+-------------------------------------+
| *Setter* | set_highlight_current_line(value) |
+----------+-------------------------------------+
| *Getter* | is_highlight_current_line_enabled() |
+----------+-------------------------------------+
If ``true``, the line containing the cursor is highlighted.
----
.. _class_TextEdit_property_override_selected_font_color:
- :ref:`bool<class_bool>` **override_selected_font_color**
+----------+-----------------------------------------+
| *Setter* | set_override_selected_font_color(value) |
+----------+-----------------------------------------+
| *Getter* | is_overriding_selected_font_color() |
+----------+-----------------------------------------+
----
.. _class_TextEdit_property_readonly:
- :ref:`bool<class_bool>` **readonly**
+----------+---------------------+
| *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.
----
.. _class_TextEdit_property_show_line_numbers:
- :ref:`bool<class_bool>` **show_line_numbers**
+----------+--------------------------------+
| *Setter* | set_show_line_numbers(value) |
+----------+--------------------------------+
| *Getter* | is_show_line_numbers_enabled() |
+----------+--------------------------------+
If ``true``, line numbers are displayed to the left of the text.
----
.. _class_TextEdit_property_smooth_scrolling:
- :ref:`bool<class_bool>` **smooth_scrolling**
+----------+---------------------------------+
| *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.
----
.. _class_TextEdit_property_syntax_highlighting:
- :ref:`bool<class_bool>` **syntax_highlighting**
+----------+------------------------------+
| *Setter* | set_syntax_coloring(value) |
+----------+------------------------------+
| *Getter* | is_syntax_coloring_enabled() |
+----------+------------------------------+
If ``true``, any custom color properties that have been set for this :ref:`TextEdit<class_TextEdit>` will be visible.
----
.. _class_TextEdit_property_text:
- :ref:`String<class_String>` **text**
+----------+-----------------+
| *Setter* | set_text(value) |
+----------+-----------------+
| *Getter* | get_text() |
+----------+-----------------+
String value of the :ref:`TextEdit<class_TextEdit>`.
----
.. _class_TextEdit_property_v_scroll_speed:
- :ref:`float<class_float>` **v_scroll_speed**
+----------+---------------------------+
| *Setter* | set_v_scroll_speed(value) |
+----------+---------------------------+
| *Getter* | get_v_scroll_speed() |
+----------+---------------------------+
Vertical scroll sensitivity.
----
.. _class_TextEdit_property_wrap_enabled:
- :ref:`bool<class_bool>` **wrap_enabled**
+----------+-------------------------+
| *Setter* | set_wrap_enabled(value) |
+----------+-------------------------+
| *Getter* | is_wrap_enabled() |
+----------+-------------------------+
If ``true``, enables text wrapping when it goes beyond the edge of what is visible.
Method Descriptions
-------------------
.. _class_TextEdit_method_add_color_region:
- void **add_color_region** **(** :ref:`String<class_String>` begin_key, :ref:`String<class_String>` end_key, :ref:`Color<class_Color>` color, :ref:`bool<class_bool>` line_only=false **)**
Add color region (given the delimiters) and its colors.
----
.. _class_TextEdit_method_add_keyword_color:
- void **add_keyword_color** **(** :ref:`String<class_String>` keyword, :ref:`Color<class_Color>` color **)**
Add a ``keyword`` and its :ref:`Color<class_Color>`.
----
.. _class_TextEdit_method_can_fold:
- :ref:`bool<class_bool>` **can_fold** **(** :ref:`int<class_int>` line **)** const
----
.. _class_TextEdit_method_clear_colors:
- void **clear_colors** **(** **)**
Clears all the syntax coloring information.
----
.. _class_TextEdit_method_clear_undo_history:
- void **clear_undo_history** **(** **)**
Clears the undo history.
----
.. _class_TextEdit_method_copy:
- void **copy** **(** **)**
Copy's the current text selection.
----
.. _class_TextEdit_method_cursor_get_column:
- :ref:`int<class_int>` **cursor_get_column** **(** **)** const
Returns the column the editing cursor is at.
----
.. _class_TextEdit_method_cursor_get_line:
- :ref:`int<class_int>` **cursor_get_line** **(** **)** const
Returns the line the editing cursor is at.
----
.. _class_TextEdit_method_cursor_set_column:
- void **cursor_set_column** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` adjust_viewport=true **)**
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. Default value is ``true``.
----
.. _class_TextEdit_method_cursor_set_line:
- void **cursor_set_line** **(** :ref:`int<class_int>` line, :ref:`bool<class_bool>` adjust_viewport=true, :ref:`bool<class_bool>` can_be_hidden=true, :ref:`int<class_int>` wrap_index=0 **)**
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. Default value is ``true``.
If ``can_be_hidden`` is set to true, the specified ``line`` can be hidden using :ref:`set_line_as_hidden<class_TextEdit_method_set_line_as_hidden>`. Default value is ``true``.
----
.. _class_TextEdit_method_cut:
- void **cut** **(** **)**
Cut's the current selection.
----
.. _class_TextEdit_method_deselect:
- void **deselect** **(** **)**
Deselects the current selection.
----
.. _class_TextEdit_method_fold_all_lines:
- void **fold_all_lines** **(** **)**
----
.. _class_TextEdit_method_fold_line:
- void **fold_line** **(** :ref:`int<class_int>` line **)**
----
.. _class_TextEdit_method_get_breakpoints:
- :ref:`Array<class_Array>` **get_breakpoints** **(** **)** const
Returns an array containing the line number of each breakpoint.
----
.. _class_TextEdit_method_get_keyword_color:
- :ref:`Color<class_Color>` **get_keyword_color** **(** :ref:`String<class_String>` keyword **)** const
Returns the :ref:`Color<class_Color>` of the specified ``keyword``.
----
.. _class_TextEdit_method_get_line:
- :ref:`String<class_String>` **get_line** **(** :ref:`int<class_int>` line **)** const
Returns the text of a specific line.
----
.. _class_TextEdit_method_get_line_count:
- :ref:`int<class_int>` **get_line_count** **(** **)** const
Returns the amount of total lines in the text.
----
.. _class_TextEdit_method_get_menu:
- :ref:`PopupMenu<class_PopupMenu>` **get_menu** **(** **)** const
----
.. _class_TextEdit_method_get_selection_from_column:
- :ref:`int<class_int>` **get_selection_from_column** **(** **)** const
Returns the selection begin column.
----
.. _class_TextEdit_method_get_selection_from_line:
- :ref:`int<class_int>` **get_selection_from_line** **(** **)** const
Returns the selection begin line.
----
.. _class_TextEdit_method_get_selection_text:
- :ref:`String<class_String>` **get_selection_text** **(** **)** const
Returns the text inside the selection.
----
.. _class_TextEdit_method_get_selection_to_column:
- :ref:`int<class_int>` **get_selection_to_column** **(** **)** const
Returns the selection end column.
----
.. _class_TextEdit_method_get_selection_to_line:
- :ref:`int<class_int>` **get_selection_to_line** **(** **)** const
Returns the selection end line.
----
.. _class_TextEdit_method_get_word_under_cursor:
- :ref:`String<class_String>` **get_word_under_cursor** **(** **)** const
Returns a :ref:`String<class_String>` text with the word under the mouse cursor location.
----
.. _class_TextEdit_method_has_keyword_color:
- :ref:`bool<class_bool>` **has_keyword_color** **(** :ref:`String<class_String>` keyword **)** const
Returns whether the specified ``keyword`` has a color set to it or not.
----
.. _class_TextEdit_method_insert_text_at_cursor:
- void **insert_text_at_cursor** **(** :ref:`String<class_String>` text **)**
Insert the specified text at the cursor position.
----
.. _class_TextEdit_method_is_folded:
- :ref:`bool<class_bool>` **is_folded** **(** :ref:`int<class_int>` line **)** const
Returns whether the line at the specified index is folded or not.
----
.. _class_TextEdit_method_is_line_hidden:
- :ref:`bool<class_bool>` **is_line_hidden** **(** :ref:`int<class_int>` line **)** const
Returns whether the line at the specified index is hidden or not.
----
.. _class_TextEdit_method_is_selection_active:
- :ref:`bool<class_bool>` **is_selection_active** **(** **)** const
Returns ``true`` if the selection is active.
----
.. _class_TextEdit_method_menu_option:
- void **menu_option** **(** :ref:`int<class_int>` option **)**
Triggers a right click menu action by the specified index. See :ref:`MenuItems<enum_TextEdit_MenuItems>` for a list of available indexes.
----
.. _class_TextEdit_method_paste:
- void **paste** **(** **)**
Paste the current selection.
----
.. _class_TextEdit_method_redo:
- void **redo** **(** **)**
Perform redo operation.
----
.. _class_TextEdit_method_remove_breakpoints:
- void **remove_breakpoints** **(** **)**
Removes all the breakpoints (without firing "breakpoint_toggled" signal).
----
.. _class_TextEdit_method_search:
- :ref:`PoolIntArray<class_PoolIntArray>` **search** **(** :ref:`String<class_String>` key, :ref:`int<class_int>` flags, :ref:`int<class_int>` from_line, :ref:`int<class_int>` from_column **)** const
Perform a search inside the text. Search flags can be specified in the SEARCH\_\* enum.
----
.. _class_TextEdit_method_select:
- void **select** **(** :ref:`int<class_int>` from_line, :ref:`int<class_int>` from_column, :ref:`int<class_int>` to_line, :ref:`int<class_int>` to_column **)**
Perform selection, from line/column to line/column.
----
.. _class_TextEdit_method_select_all:
- void **select_all** **(** **)**
Select all the text.
----
.. _class_TextEdit_method_set_line_as_hidden:
- void **set_line_as_hidden** **(** :ref:`int<class_int>` line, :ref:`bool<class_bool>` enable **)**
If ``true``, hides the line of the specified index.
----
.. _class_TextEdit_method_toggle_fold_line:
- void **toggle_fold_line** **(** :ref:`int<class_int>` line **)**
Toggle the folding of the code block at the given line.
----
.. _class_TextEdit_method_undo:
- void **undo** **(** **)**
Perform undo operation.
----
.. _class_TextEdit_method_unfold_line:
- void **unfold_line** **(** :ref:`int<class_int>` line **)**
----
.. _class_TextEdit_method_unhide_all_lines:
- void **unhide_all_lines** **(** **)**
Unhide all lines that were previously set to hidden by :ref:`set_line_as_hidden<class_TextEdit_method_set_line_as_hidden>`.