mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
437 lines
29 KiB
ReStructuredText
437 lines
29 KiB
ReStructuredText
.. 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.
|
|
|
|
Member Functions
|
|
----------------
|
|
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`add_color_region<class_TextEdit_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_add_keyword_color>` **(** :ref:`String<class_string>` keyword, :ref:`Color<class_color>` color **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`can_fold<class_TextEdit_can_fold>` **(** :ref:`int<class_int>` line **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`clear_colors<class_TextEdit_clear_colors>` **(** **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`clear_undo_history<class_TextEdit_clear_undo_history>` **(** **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`copy<class_TextEdit_copy>` **(** **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`cursor_get_column<class_TextEdit_cursor_get_column>` **(** **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`cursor_get_line<class_TextEdit_cursor_get_line>` **(** **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`cursor_set_column<class_TextEdit_cursor_set_column>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` adjust_viewport=true **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`cursor_set_line<class_TextEdit_cursor_set_line>` **(** :ref:`int<class_int>` line, :ref:`bool<class_bool>` adjust_viewport=true, :ref:`bool<class_bool>` can_be_hidden=true **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`cut<class_TextEdit_cut>` **(** **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`deselect<class_TextEdit_deselect>` **(** **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`fold_all_lines<class_TextEdit_fold_all_lines>` **(** **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`fold_line<class_TextEdit_fold_line>` **(** :ref:`int<class_int>` line **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`String<class_string>` | :ref:`get_line<class_TextEdit_get_line>` **(** :ref:`int<class_int>` line **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_line_count<class_TextEdit_get_line_count>` **(** **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PopupMenu<class_popupmenu>` | :ref:`get_menu<class_TextEdit_get_menu>` **(** **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_selection_from_column<class_TextEdit_get_selection_from_column>` **(** **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_selection_from_line<class_TextEdit_get_selection_from_line>` **(** **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`String<class_string>` | :ref:`get_selection_text<class_TextEdit_get_selection_text>` **(** **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_selection_to_column<class_TextEdit_get_selection_to_column>` **(** **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_selection_to_line<class_TextEdit_get_selection_to_line>` **(** **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`String<class_string>` | :ref:`get_word_under_cursor<class_TextEdit_get_word_under_cursor>` **(** **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`insert_text_at_cursor<class_TextEdit_insert_text_at_cursor>` **(** :ref:`String<class_string>` text **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_folded<class_TextEdit_is_folded>` **(** :ref:`int<class_int>` line **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_line_hidden<class_TextEdit_is_line_hidden>` **(** :ref:`int<class_int>` line **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_selection_active<class_TextEdit_is_selection_active>` **(** **)** const |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`menu_option<class_TextEdit_menu_option>` **(** :ref:`int<class_int>` option **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`paste<class_TextEdit_paste>` **(** **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`redo<class_TextEdit_redo>` **(** **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PoolIntArray<class_poolintarray>` | :ref:`search<class_TextEdit_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_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_select_all>` **(** **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_line_as_hidden<class_TextEdit_set_line_as_hidden>` **(** :ref:`int<class_int>` line, :ref:`bool<class_bool>` enable **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`toggle_fold_line<class_TextEdit_toggle_fold_line>` **(** :ref:`int<class_int>` line **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`undo<class_TextEdit_undo>` **(** **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`unfold_line<class_TextEdit_unfold_line>` **(** :ref:`int<class_int>` line **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`unhide_all_lines<class_TextEdit_unhide_all_lines>` **(** **)** |
|
|
+------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Signals
|
|
-------
|
|
|
|
.. _class_TextEdit_breakpoint_toggled:
|
|
|
|
- **breakpoint_toggled** **(** :ref:`int<class_int>` row **)**
|
|
|
|
Emitted when a breakpoint is placed via the breakpoint gutter.
|
|
|
|
.. _class_TextEdit_cursor_changed:
|
|
|
|
- **cursor_changed** **(** **)**
|
|
|
|
Emitted when the cursor changes.
|
|
|
|
.. _class_TextEdit_request_completion:
|
|
|
|
- **request_completion** **(** **)**
|
|
|
|
.. _class_TextEdit_symbol_lookup:
|
|
|
|
- **symbol_lookup** **(** :ref:`String<class_string>` symbol, :ref:`int<class_int>` row, :ref:`int<class_int>` column **)**
|
|
|
|
.. _class_TextEdit_text_changed:
|
|
|
|
- **text_changed** **(** **)**
|
|
|
|
Emitted when the text changes.
|
|
|
|
|
|
Member Variables
|
|
----------------
|
|
|
|
.. _class_TextEdit_caret_blink:
|
|
|
|
- :ref:`bool<class_bool>` **caret_blink** - If ``true`` the caret (visual cursor) blinks.
|
|
|
|
.. _class_TextEdit_caret_blink_speed:
|
|
|
|
- :ref:`float<class_float>` **caret_blink_speed** - Duration (in seconds) of a caret's blinking cycle.
|
|
|
|
.. _class_TextEdit_caret_block_mode:
|
|
|
|
- :ref:`bool<class_bool>` **caret_block_mode** - If ``true`` the caret displays as a rectangle.
|
|
|
|
If ``false`` the caret displays as a bar.
|
|
|
|
.. _class_TextEdit_caret_moving_by_right_click:
|
|
|
|
- :ref:`bool<class_bool>` **caret_moving_by_right_click** - 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_context_menu_enabled:
|
|
|
|
- :ref:`bool<class_bool>` **context_menu_enabled** - If ``true`` a right click displays the context menu.
|
|
|
|
.. _class_TextEdit_hiding_enabled:
|
|
|
|
- :ref:`int<class_int>` **hiding_enabled**
|
|
|
|
.. _class_TextEdit_highlight_all_occurrences:
|
|
|
|
- :ref:`bool<class_bool>` **highlight_all_occurrences**
|
|
|
|
.. _class_TextEdit_highlight_current_line:
|
|
|
|
- :ref:`bool<class_bool>` **highlight_current_line** - If ``true`` the line containing the cursor is highlighted.
|
|
|
|
.. _class_TextEdit_override_selected_font_color:
|
|
|
|
- :ref:`bool<class_bool>` **override_selected_font_color**
|
|
|
|
.. _class_TextEdit_readonly:
|
|
|
|
- :ref:`bool<class_bool>` **readonly** - If ``true`` read-only mode is enabled. Existing text cannot be modified and new text cannot be added.
|
|
|
|
.. _class_TextEdit_show_line_numbers:
|
|
|
|
- :ref:`bool<class_bool>` **show_line_numbers** - If ``true`` line numbers are displayed to the left of the text.
|
|
|
|
.. _class_TextEdit_smooth_scrolling:
|
|
|
|
- :ref:`bool<class_bool>` **smooth_scrolling**
|
|
|
|
.. _class_TextEdit_syntax_highlighting:
|
|
|
|
- :ref:`bool<class_bool>` **syntax_highlighting**
|
|
|
|
.. _class_TextEdit_text:
|
|
|
|
- :ref:`String<class_string>` **text** - String value of the :ref:`TextEdit<class_textedit>`.
|
|
|
|
.. _class_TextEdit_v_scroll_speed:
|
|
|
|
- :ref:`float<class_float>` **v_scroll_speed** - If ``true``, enables text wrapping when it goes beyond he edge of what is visible.
|
|
|
|
.. _class_TextEdit_wrap_lines:
|
|
|
|
- :ref:`bool<class_bool>` **wrap_lines**
|
|
|
|
|
|
Enums
|
|
-----
|
|
|
|
.. _enum_TextEdit_MenuItems:
|
|
|
|
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_MAX** = **6**
|
|
|
|
.. _enum_TextEdit_SearchFlags:
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
|
|
Member Function Description
|
|
---------------------------
|
|
|
|
.. _class_TextEdit_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_add_keyword_color:
|
|
|
|
- void **add_keyword_color** **(** :ref:`String<class_string>` keyword, :ref:`Color<class_color>` color **)**
|
|
|
|
Add a keyword and its color.
|
|
|
|
.. _class_TextEdit_can_fold:
|
|
|
|
- :ref:`bool<class_bool>` **can_fold** **(** :ref:`int<class_int>` line **)** const
|
|
|
|
.. _class_TextEdit_clear_colors:
|
|
|
|
- void **clear_colors** **(** **)**
|
|
|
|
Clear all the syntax coloring information.
|
|
|
|
.. _class_TextEdit_clear_undo_history:
|
|
|
|
- void **clear_undo_history** **(** **)**
|
|
|
|
Clear the undo history.
|
|
|
|
.. _class_TextEdit_copy:
|
|
|
|
- void **copy** **(** **)**
|
|
|
|
Copy the current selection.
|
|
|
|
.. _class_TextEdit_cursor_get_column:
|
|
|
|
- :ref:`int<class_int>` **cursor_get_column** **(** **)** const
|
|
|
|
Return the column the editing cursor is at.
|
|
|
|
.. _class_TextEdit_cursor_get_line:
|
|
|
|
- :ref:`int<class_int>` **cursor_get_line** **(** **)** const
|
|
|
|
Return the line the editing cursor is at.
|
|
|
|
.. _class_TextEdit_cursor_set_column:
|
|
|
|
- void **cursor_set_column** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` adjust_viewport=true **)**
|
|
|
|
.. _class_TextEdit_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 **)**
|
|
|
|
.. _class_TextEdit_cut:
|
|
|
|
- void **cut** **(** **)**
|
|
|
|
Cut the current selection.
|
|
|
|
.. _class_TextEdit_deselect:
|
|
|
|
- void **deselect** **(** **)**
|
|
|
|
Clears the current selection.
|
|
|
|
.. _class_TextEdit_fold_all_lines:
|
|
|
|
- void **fold_all_lines** **(** **)**
|
|
|
|
.. _class_TextEdit_fold_line:
|
|
|
|
- void **fold_line** **(** :ref:`int<class_int>` line **)**
|
|
|
|
.. _class_TextEdit_get_line:
|
|
|
|
- :ref:`String<class_string>` **get_line** **(** :ref:`int<class_int>` line **)** const
|
|
|
|
Return the text of a specific line.
|
|
|
|
.. _class_TextEdit_get_line_count:
|
|
|
|
- :ref:`int<class_int>` **get_line_count** **(** **)** const
|
|
|
|
Return the amount of total lines in the text.
|
|
|
|
.. _class_TextEdit_get_menu:
|
|
|
|
- :ref:`PopupMenu<class_popupmenu>` **get_menu** **(** **)** const
|
|
|
|
.. _class_TextEdit_get_selection_from_column:
|
|
|
|
- :ref:`int<class_int>` **get_selection_from_column** **(** **)** const
|
|
|
|
Return the selection begin column.
|
|
|
|
.. _class_TextEdit_get_selection_from_line:
|
|
|
|
- :ref:`int<class_int>` **get_selection_from_line** **(** **)** const
|
|
|
|
Return the selection begin line.
|
|
|
|
.. _class_TextEdit_get_selection_text:
|
|
|
|
- :ref:`String<class_string>` **get_selection_text** **(** **)** const
|
|
|
|
Return the text inside the selection.
|
|
|
|
.. _class_TextEdit_get_selection_to_column:
|
|
|
|
- :ref:`int<class_int>` **get_selection_to_column** **(** **)** const
|
|
|
|
Return the selection end column.
|
|
|
|
.. _class_TextEdit_get_selection_to_line:
|
|
|
|
- :ref:`int<class_int>` **get_selection_to_line** **(** **)** const
|
|
|
|
Return the selection end line.
|
|
|
|
.. _class_TextEdit_get_word_under_cursor:
|
|
|
|
- :ref:`String<class_string>` **get_word_under_cursor** **(** **)** const
|
|
|
|
.. _class_TextEdit_insert_text_at_cursor:
|
|
|
|
- void **insert_text_at_cursor** **(** :ref:`String<class_string>` text **)**
|
|
|
|
Insert a given text at the cursor position.
|
|
|
|
.. _class_TextEdit_is_folded:
|
|
|
|
- :ref:`bool<class_bool>` **is_folded** **(** :ref:`int<class_int>` line **)** const
|
|
|
|
.. _class_TextEdit_is_line_hidden:
|
|
|
|
- :ref:`bool<class_bool>` **is_line_hidden** **(** :ref:`int<class_int>` line **)** const
|
|
|
|
.. _class_TextEdit_is_selection_active:
|
|
|
|
- :ref:`bool<class_bool>` **is_selection_active** **(** **)** const
|
|
|
|
Return true if the selection is active.
|
|
|
|
.. _class_TextEdit_menu_option:
|
|
|
|
- void **menu_option** **(** :ref:`int<class_int>` option **)**
|
|
|
|
.. _class_TextEdit_paste:
|
|
|
|
- void **paste** **(** **)**
|
|
|
|
Paste the current selection.
|
|
|
|
.. _class_TextEdit_redo:
|
|
|
|
- void **redo** **(** **)**
|
|
|
|
Perform redo operation.
|
|
|
|
.. _class_TextEdit_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_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_select_all:
|
|
|
|
- void **select_all** **(** **)**
|
|
|
|
Select all the text.
|
|
|
|
.. _class_TextEdit_set_line_as_hidden:
|
|
|
|
- void **set_line_as_hidden** **(** :ref:`int<class_int>` line, :ref:`bool<class_bool>` enable **)**
|
|
|
|
.. _class_TextEdit_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_undo:
|
|
|
|
- void **undo** **(** **)**
|
|
|
|
Perform undo operation.
|
|
|
|
.. _class_TextEdit_unfold_line:
|
|
|
|
- void **unfold_line** **(** :ref:`int<class_int>` line **)**
|
|
|
|
.. _class_TextEdit_unhide_all_lines:
|
|
|
|
- void **unhide_all_lines** **(** **)**
|
|
|
|
|