class_textedit.rst 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the TextEdit.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_TextEdit:
  6. TextEdit
  7. ========
  8. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Multiline text editing control.
  13. Properties
  14. ----------
  15. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  16. | :ref:`bool<class_bool>` | :ref:`breakpoint_gutter<class_TextEdit_property_breakpoint_gutter>` | false |
  17. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  18. | :ref:`bool<class_bool>` | :ref:`caret_blink<class_TextEdit_property_caret_blink>` | false |
  19. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  20. | :ref:`float<class_float>` | :ref:`caret_blink_speed<class_TextEdit_property_caret_blink_speed>` | 0.65 |
  21. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  22. | :ref:`bool<class_bool>` | :ref:`caret_block_mode<class_TextEdit_property_caret_block_mode>` | false |
  23. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  24. | :ref:`bool<class_bool>` | :ref:`caret_moving_by_right_click<class_TextEdit_property_caret_moving_by_right_click>` | true |
  25. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  26. | :ref:`bool<class_bool>` | :ref:`context_menu_enabled<class_TextEdit_property_context_menu_enabled>` | true |
  27. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  28. | :ref:`bool<class_bool>` | :ref:`draw_spaces<class_TextEdit_property_draw_spaces>` | false |
  29. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  30. | :ref:`bool<class_bool>` | :ref:`draw_tabs<class_TextEdit_property_draw_tabs>` | false |
  31. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  32. | :ref:`bool<class_bool>` | :ref:`fold_gutter<class_TextEdit_property_fold_gutter>` | false |
  33. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  34. | :ref:`bool<class_bool>` | :ref:`hiding_enabled<class_TextEdit_property_hiding_enabled>` | false |
  35. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  36. | :ref:`bool<class_bool>` | :ref:`highlight_all_occurrences<class_TextEdit_property_highlight_all_occurrences>` | false |
  37. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  38. | :ref:`bool<class_bool>` | :ref:`highlight_current_line<class_TextEdit_property_highlight_current_line>` | false |
  39. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  40. | :ref:`bool<class_bool>` | :ref:`override_selected_font_color<class_TextEdit_property_override_selected_font_color>` | false |
  41. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  42. | :ref:`bool<class_bool>` | :ref:`readonly<class_TextEdit_property_readonly>` | false |
  43. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  44. | :ref:`bool<class_bool>` | :ref:`show_line_numbers<class_TextEdit_property_show_line_numbers>` | false |
  45. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  46. | :ref:`bool<class_bool>` | :ref:`smooth_scrolling<class_TextEdit_property_smooth_scrolling>` | false |
  47. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  48. | :ref:`bool<class_bool>` | :ref:`syntax_highlighting<class_TextEdit_property_syntax_highlighting>` | false |
  49. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  50. | :ref:`String<class_String>` | :ref:`text<class_TextEdit_property_text>` | "" |
  51. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  52. | :ref:`float<class_float>` | :ref:`v_scroll_speed<class_TextEdit_property_v_scroll_speed>` | 80.0 |
  53. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  54. | :ref:`bool<class_bool>` | :ref:`wrap_enabled<class_TextEdit_property_wrap_enabled>` | false |
  55. +-----------------------------+-------------------------------------------------------------------------------------------+-------+
  56. Methods
  57. -------
  58. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | 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 **)** |
  60. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | void | :ref:`add_keyword_color<class_TextEdit_method_add_keyword_color>` **(** :ref:`String<class_String>` keyword, :ref:`Color<class_Color>` color **)** |
  62. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`bool<class_bool>` | :ref:`can_fold<class_TextEdit_method_can_fold>` **(** :ref:`int<class_int>` line **)** const |
  64. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`center_viewport_to_cursor<class_TextEdit_method_center_viewport_to_cursor>` **(** **)** |
  66. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`clear_colors<class_TextEdit_method_clear_colors>` **(** **)** |
  68. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`clear_undo_history<class_TextEdit_method_clear_undo_history>` **(** **)** |
  70. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`copy<class_TextEdit_method_copy>` **(** **)** |
  72. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`int<class_int>` | :ref:`cursor_get_column<class_TextEdit_method_cursor_get_column>` **(** **)** const |
  74. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`int<class_int>` | :ref:`cursor_get_line<class_TextEdit_method_cursor_get_line>` **(** **)** const |
  76. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`cursor_set_column<class_TextEdit_method_cursor_set_column>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` adjust_viewport=true **)** |
  78. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | 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 **)** |
  80. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | void | :ref:`cut<class_TextEdit_method_cut>` **(** **)** |
  82. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`deselect<class_TextEdit_method_deselect>` **(** **)** |
  84. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | void | :ref:`fold_all_lines<class_TextEdit_method_fold_all_lines>` **(** **)** |
  86. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`fold_line<class_TextEdit_method_fold_line>` **(** :ref:`int<class_int>` line **)** |
  88. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`Array<class_Array>` | :ref:`get_breakpoints<class_TextEdit_method_get_breakpoints>` **(** **)** const |
  90. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`Color<class_Color>` | :ref:`get_keyword_color<class_TextEdit_method_get_keyword_color>` **(** :ref:`String<class_String>` keyword **)** const |
  92. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`String<class_String>` | :ref:`get_line<class_TextEdit_method_get_line>` **(** :ref:`int<class_int>` line **)** const |
  94. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`int<class_int>` | :ref:`get_line_count<class_TextEdit_method_get_line_count>` **(** **)** const |
  96. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`PopupMenu<class_PopupMenu>` | :ref:`get_menu<class_TextEdit_method_get_menu>` **(** **)** const |
  98. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`int<class_int>` | :ref:`get_selection_from_column<class_TextEdit_method_get_selection_from_column>` **(** **)** const |
  100. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`int<class_int>` | :ref:`get_selection_from_line<class_TextEdit_method_get_selection_from_line>` **(** **)** const |
  102. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`String<class_String>` | :ref:`get_selection_text<class_TextEdit_method_get_selection_text>` **(** **)** const |
  104. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`int<class_int>` | :ref:`get_selection_to_column<class_TextEdit_method_get_selection_to_column>` **(** **)** const |
  106. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`int<class_int>` | :ref:`get_selection_to_line<class_TextEdit_method_get_selection_to_line>` **(** **)** const |
  108. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`String<class_String>` | :ref:`get_word_under_cursor<class_TextEdit_method_get_word_under_cursor>` **(** **)** const |
  110. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`bool<class_bool>` | :ref:`has_keyword_color<class_TextEdit_method_has_keyword_color>` **(** :ref:`String<class_String>` keyword **)** const |
  112. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | void | :ref:`insert_text_at_cursor<class_TextEdit_method_insert_text_at_cursor>` **(** :ref:`String<class_String>` text **)** |
  114. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | :ref:`bool<class_bool>` | :ref:`is_folded<class_TextEdit_method_is_folded>` **(** :ref:`int<class_int>` line **)** const |
  116. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | :ref:`bool<class_bool>` | :ref:`is_line_hidden<class_TextEdit_method_is_line_hidden>` **(** :ref:`int<class_int>` line **)** const |
  118. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | :ref:`bool<class_bool>` | :ref:`is_selection_active<class_TextEdit_method_is_selection_active>` **(** **)** const |
  120. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | void | :ref:`menu_option<class_TextEdit_method_menu_option>` **(** :ref:`int<class_int>` option **)** |
  122. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | void | :ref:`paste<class_TextEdit_method_paste>` **(** **)** |
  124. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | void | :ref:`redo<class_TextEdit_method_redo>` **(** **)** |
  126. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | void | :ref:`remove_breakpoints<class_TextEdit_method_remove_breakpoints>` **(** **)** |
  128. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :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 |
  130. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | 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 **)** |
  132. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | void | :ref:`select_all<class_TextEdit_method_select_all>` **(** **)** |
  134. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | void | :ref:`set_line_as_hidden<class_TextEdit_method_set_line_as_hidden>` **(** :ref:`int<class_int>` line, :ref:`bool<class_bool>` enable **)** |
  136. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | void | :ref:`toggle_fold_line<class_TextEdit_method_toggle_fold_line>` **(** :ref:`int<class_int>` line **)** |
  138. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | void | :ref:`undo<class_TextEdit_method_undo>` **(** **)** |
  140. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | void | :ref:`unfold_line<class_TextEdit_method_unfold_line>` **(** :ref:`int<class_int>` line **)** |
  142. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | void | :ref:`unhide_all_lines<class_TextEdit_method_unhide_all_lines>` **(** **)** |
  144. +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. Theme Properties
  146. ----------------
  147. +---------------------------------+-----------------------------+---------------------------------+
  148. | :ref:`Color<class_Color>` | background_color | Color( 0, 0, 0, 1 ) |
  149. +---------------------------------+-----------------------------+---------------------------------+
  150. | :ref:`Color<class_Color>` | bookmark_color | Color( 0.08, 0.49, 0.98, 1 ) |
  151. +---------------------------------+-----------------------------+---------------------------------+
  152. | :ref:`Color<class_Color>` | brace_mismatch_color | Color( 1, 0.2, 0.2, 1 ) |
  153. +---------------------------------+-----------------------------+---------------------------------+
  154. | :ref:`Color<class_Color>` | breakpoint_color | Color( 0.8, 0.8, 0.4, 0.2 ) |
  155. +---------------------------------+-----------------------------+---------------------------------+
  156. | :ref:`Color<class_Color>` | caret_background_color | Color( 0, 0, 0, 1 ) |
  157. +---------------------------------+-----------------------------+---------------------------------+
  158. | :ref:`Color<class_Color>` | caret_color | Color( 0.88, 0.88, 0.88, 1 ) |
  159. +---------------------------------+-----------------------------+---------------------------------+
  160. | :ref:`Color<class_Color>` | code_folding_color | Color( 0.8, 0.8, 0.8, 0.8 ) |
  161. +---------------------------------+-----------------------------+---------------------------------+
  162. | :ref:`StyleBox<class_StyleBox>` | completion | |
  163. +---------------------------------+-----------------------------+---------------------------------+
  164. | :ref:`Color<class_Color>` | completion_background_color | Color( 0.17, 0.16, 0.2, 1 ) |
  165. +---------------------------------+-----------------------------+---------------------------------+
  166. | :ref:`Color<class_Color>` | completion_existing_color | Color( 0.87, 0.87, 0.87, 0.13 ) |
  167. +---------------------------------+-----------------------------+---------------------------------+
  168. | :ref:`Color<class_Color>` | completion_font_color | Color( 0.67, 0.67, 0.67, 1 ) |
  169. +---------------------------------+-----------------------------+---------------------------------+
  170. | :ref:`int<class_int>` | completion_lines | 7 |
  171. +---------------------------------+-----------------------------+---------------------------------+
  172. | :ref:`int<class_int>` | completion_max_width | 50 |
  173. +---------------------------------+-----------------------------+---------------------------------+
  174. | :ref:`Color<class_Color>` | completion_scroll_color | Color( 1, 1, 1, 1 ) |
  175. +---------------------------------+-----------------------------+---------------------------------+
  176. | :ref:`int<class_int>` | completion_scroll_width | 3 |
  177. +---------------------------------+-----------------------------+---------------------------------+
  178. | :ref:`Color<class_Color>` | completion_selected_color | Color( 0.26, 0.26, 0.27, 1 ) |
  179. +---------------------------------+-----------------------------+---------------------------------+
  180. | :ref:`Color<class_Color>` | current_line_color | Color( 0.25, 0.25, 0.26, 0.8 ) |
  181. +---------------------------------+-----------------------------+---------------------------------+
  182. | :ref:`Color<class_Color>` | executing_line_color | Color( 0.2, 0.8, 0.2, 0.4 ) |
  183. +---------------------------------+-----------------------------+---------------------------------+
  184. | :ref:`StyleBox<class_StyleBox>` | focus | |
  185. +---------------------------------+-----------------------------+---------------------------------+
  186. | :ref:`Texture<class_Texture>` | fold | |
  187. +---------------------------------+-----------------------------+---------------------------------+
  188. | :ref:`Texture<class_Texture>` | folded | |
  189. +---------------------------------+-----------------------------+---------------------------------+
  190. | :ref:`Font<class_Font>` | font | |
  191. +---------------------------------+-----------------------------+---------------------------------+
  192. | :ref:`Color<class_Color>` | font_color | Color( 0.88, 0.88, 0.88, 1 ) |
  193. +---------------------------------+-----------------------------+---------------------------------+
  194. | :ref:`Color<class_Color>` | font_color_readonly | Color( 0.88, 0.88, 0.88, 0.5 ) |
  195. +---------------------------------+-----------------------------+---------------------------------+
  196. | :ref:`Color<class_Color>` | font_color_selected | Color( 0, 0, 0, 1 ) |
  197. +---------------------------------+-----------------------------+---------------------------------+
  198. | :ref:`Color<class_Color>` | function_color | Color( 0.4, 0.64, 0.81, 1 ) |
  199. +---------------------------------+-----------------------------+---------------------------------+
  200. | :ref:`Color<class_Color>` | line_number_color | Color( 0.67, 0.67, 0.67, 0.4 ) |
  201. +---------------------------------+-----------------------------+---------------------------------+
  202. | :ref:`int<class_int>` | line_spacing | 4 |
  203. +---------------------------------+-----------------------------+---------------------------------+
  204. | :ref:`Color<class_Color>` | mark_color | Color( 1, 0.4, 0.4, 0.4 ) |
  205. +---------------------------------+-----------------------------+---------------------------------+
  206. | :ref:`Color<class_Color>` | member_variable_color | Color( 0.9, 0.31, 0.35, 1 ) |
  207. +---------------------------------+-----------------------------+---------------------------------+
  208. | :ref:`StyleBox<class_StyleBox>` | normal | |
  209. +---------------------------------+-----------------------------+---------------------------------+
  210. | :ref:`Color<class_Color>` | number_color | Color( 0.92, 0.58, 0.2, 1 ) |
  211. +---------------------------------+-----------------------------+---------------------------------+
  212. | :ref:`StyleBox<class_StyleBox>` | read_only | |
  213. +---------------------------------+-----------------------------+---------------------------------+
  214. | :ref:`Color<class_Color>` | safe_line_number_color | Color( 0.67, 0.78, 0.67, 0.6 ) |
  215. +---------------------------------+-----------------------------+---------------------------------+
  216. | :ref:`Color<class_Color>` | selection_color | Color( 0.49, 0.49, 0.49, 1 ) |
  217. +---------------------------------+-----------------------------+---------------------------------+
  218. | :ref:`Texture<class_Texture>` | space | |
  219. +---------------------------------+-----------------------------+---------------------------------+
  220. | :ref:`Color<class_Color>` | symbol_color | Color( 0.94, 0.94, 0.94, 1 ) |
  221. +---------------------------------+-----------------------------+---------------------------------+
  222. | :ref:`Texture<class_Texture>` | tab | |
  223. +---------------------------------+-----------------------------+---------------------------------+
  224. | :ref:`Color<class_Color>` | word_highlighted_color | Color( 0.8, 0.9, 0.9, 0.15 ) |
  225. +---------------------------------+-----------------------------+---------------------------------+
  226. Signals
  227. -------
  228. .. _class_TextEdit_signal_breakpoint_toggled:
  229. - **breakpoint_toggled** **(** :ref:`int<class_int>` row **)**
  230. Emitted when a breakpoint is placed via the breakpoint gutter.
  231. .. _class_TextEdit_signal_cursor_changed:
  232. - **cursor_changed** **(** **)**
  233. Emitted when the cursor changes.
  234. .. _class_TextEdit_signal_info_clicked:
  235. - **info_clicked** **(** :ref:`int<class_int>` row, :ref:`String<class_String>` info **)**
  236. Emitted when the info icon is clicked.
  237. .. _class_TextEdit_signal_request_completion:
  238. - **request_completion** **(** **)**
  239. .. _class_TextEdit_signal_symbol_lookup:
  240. - **symbol_lookup** **(** :ref:`String<class_String>` symbol, :ref:`int<class_int>` row, :ref:`int<class_int>` column **)**
  241. .. _class_TextEdit_signal_text_changed:
  242. - **text_changed** **(** **)**
  243. Emitted when the text changes.
  244. Enumerations
  245. ------------
  246. .. _enum_TextEdit_SearchFlags:
  247. .. _class_TextEdit_constant_SEARCH_MATCH_CASE:
  248. .. _class_TextEdit_constant_SEARCH_WHOLE_WORDS:
  249. .. _class_TextEdit_constant_SEARCH_BACKWARDS:
  250. enum **SearchFlags**:
  251. - **SEARCH_MATCH_CASE** = **1** --- Match case when searching.
  252. - **SEARCH_WHOLE_WORDS** = **2** --- Match whole words when searching.
  253. - **SEARCH_BACKWARDS** = **4** --- Search from end to beginning.
  254. .. _enum_TextEdit_MenuItems:
  255. .. _class_TextEdit_constant_MENU_CUT:
  256. .. _class_TextEdit_constant_MENU_COPY:
  257. .. _class_TextEdit_constant_MENU_PASTE:
  258. .. _class_TextEdit_constant_MENU_CLEAR:
  259. .. _class_TextEdit_constant_MENU_SELECT_ALL:
  260. .. _class_TextEdit_constant_MENU_UNDO:
  261. .. _class_TextEdit_constant_MENU_REDO:
  262. .. _class_TextEdit_constant_MENU_MAX:
  263. enum **MenuItems**:
  264. - **MENU_CUT** = **0** --- Cuts (Copies and clears) the selected text.
  265. - **MENU_COPY** = **1** --- Copies the selected text.
  266. - **MENU_PASTE** = **2** --- Pastes the clipboard text over the selected text (or at the cursor's position).
  267. - **MENU_CLEAR** = **3** --- Erases the whole ``TextEdit`` text.
  268. - **MENU_SELECT_ALL** = **4** --- Selects the whole ``TextEdit`` text.
  269. - **MENU_UNDO** = **5** --- Undoes the previous action.
  270. - **MENU_REDO** = **6** --- Redoes the previous action.
  271. - **MENU_MAX** = **7** --- Represents the size of the :ref:`MenuItems<enum_TextEdit_MenuItems>` enum.
  272. Description
  273. -----------
  274. 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.
  275. Property Descriptions
  276. ---------------------
  277. .. _class_TextEdit_property_breakpoint_gutter:
  278. - :ref:`bool<class_bool>` **breakpoint_gutter**
  279. +-----------+--------------------------------------+
  280. | *Default* | false |
  281. +-----------+--------------------------------------+
  282. | *Setter* | set_breakpoint_gutter_enabled(value) |
  283. +-----------+--------------------------------------+
  284. | *Getter* | is_breakpoint_gutter_enabled() |
  285. +-----------+--------------------------------------+
  286. If ``true``, the breakpoint gutter is visible.
  287. .. _class_TextEdit_property_caret_blink:
  288. - :ref:`bool<class_bool>` **caret_blink**
  289. +-----------+---------------------------------+
  290. | *Default* | false |
  291. +-----------+---------------------------------+
  292. | *Setter* | cursor_set_blink_enabled(value) |
  293. +-----------+---------------------------------+
  294. | *Getter* | cursor_get_blink_enabled() |
  295. +-----------+---------------------------------+
  296. If ``true``, the caret (visual cursor) blinks.
  297. .. _class_TextEdit_property_caret_blink_speed:
  298. - :ref:`float<class_float>` **caret_blink_speed**
  299. +-----------+-------------------------------+
  300. | *Default* | 0.65 |
  301. +-----------+-------------------------------+
  302. | *Setter* | cursor_set_blink_speed(value) |
  303. +-----------+-------------------------------+
  304. | *Getter* | cursor_get_blink_speed() |
  305. +-----------+-------------------------------+
  306. Duration (in seconds) of a caret's blinking cycle.
  307. .. _class_TextEdit_property_caret_block_mode:
  308. - :ref:`bool<class_bool>` **caret_block_mode**
  309. +-----------+------------------------------+
  310. | *Default* | false |
  311. +-----------+------------------------------+
  312. | *Setter* | cursor_set_block_mode(value) |
  313. +-----------+------------------------------+
  314. | *Getter* | cursor_is_block_mode() |
  315. +-----------+------------------------------+
  316. If ``true``, the caret displays as a rectangle.
  317. If ``false``, the caret displays as a bar.
  318. .. _class_TextEdit_property_caret_moving_by_right_click:
  319. - :ref:`bool<class_bool>` **caret_moving_by_right_click**
  320. +-----------+------------------------------------+
  321. | *Default* | true |
  322. +-----------+------------------------------------+
  323. | *Setter* | set_right_click_moves_caret(value) |
  324. +-----------+------------------------------------+
  325. | *Getter* | is_right_click_moving_caret() |
  326. +-----------+------------------------------------+
  327. If ``true``, a right-click moves the cursor at the mouse position before displaying the context menu.
  328. If ``false``, the context menu disregards mouse location.
  329. .. _class_TextEdit_property_context_menu_enabled:
  330. - :ref:`bool<class_bool>` **context_menu_enabled**
  331. +-----------+---------------------------------+
  332. | *Default* | true |
  333. +-----------+---------------------------------+
  334. | *Setter* | set_context_menu_enabled(value) |
  335. +-----------+---------------------------------+
  336. | *Getter* | is_context_menu_enabled() |
  337. +-----------+---------------------------------+
  338. If ``true``, a right-click displays the context menu.
  339. .. _class_TextEdit_property_draw_spaces:
  340. - :ref:`bool<class_bool>` **draw_spaces**
  341. +-----------+------------------------+
  342. | *Default* | false |
  343. +-----------+------------------------+
  344. | *Setter* | set_draw_spaces(value) |
  345. +-----------+------------------------+
  346. | *Getter* | is_drawing_spaces() |
  347. +-----------+------------------------+
  348. If ``true``, the "space" character will have a visible representation.
  349. .. _class_TextEdit_property_draw_tabs:
  350. - :ref:`bool<class_bool>` **draw_tabs**
  351. +-----------+----------------------+
  352. | *Default* | false |
  353. +-----------+----------------------+
  354. | *Setter* | set_draw_tabs(value) |
  355. +-----------+----------------------+
  356. | *Getter* | is_drawing_tabs() |
  357. +-----------+----------------------+
  358. If ``true``, the "tab" character will have a visible representation.
  359. .. _class_TextEdit_property_fold_gutter:
  360. - :ref:`bool<class_bool>` **fold_gutter**
  361. +-----------+-----------------------------+
  362. | *Default* | false |
  363. +-----------+-----------------------------+
  364. | *Setter* | set_draw_fold_gutter(value) |
  365. +-----------+-----------------------------+
  366. | *Getter* | is_drawing_fold_gutter() |
  367. +-----------+-----------------------------+
  368. If ``true``, the fold gutter is visible. This enables folding groups of indented lines.
  369. .. _class_TextEdit_property_hiding_enabled:
  370. - :ref:`bool<class_bool>` **hiding_enabled**
  371. +-----------+---------------------------+
  372. | *Default* | false |
  373. +-----------+---------------------------+
  374. | *Setter* | set_hiding_enabled(value) |
  375. +-----------+---------------------------+
  376. | *Getter* | is_hiding_enabled() |
  377. +-----------+---------------------------+
  378. If ``true``, all lines that have been set to hidden by :ref:`set_line_as_hidden<class_TextEdit_method_set_line_as_hidden>`, will not be visible.
  379. .. _class_TextEdit_property_highlight_all_occurrences:
  380. - :ref:`bool<class_bool>` **highlight_all_occurrences**
  381. +-----------+----------------------------------------+
  382. | *Default* | false |
  383. +-----------+----------------------------------------+
  384. | *Setter* | set_highlight_all_occurrences(value) |
  385. +-----------+----------------------------------------+
  386. | *Getter* | is_highlight_all_occurrences_enabled() |
  387. +-----------+----------------------------------------+
  388. If ``true``, all occurrences of the selected text will be highlighted.
  389. .. _class_TextEdit_property_highlight_current_line:
  390. - :ref:`bool<class_bool>` **highlight_current_line**
  391. +-----------+-------------------------------------+
  392. | *Default* | false |
  393. +-----------+-------------------------------------+
  394. | *Setter* | set_highlight_current_line(value) |
  395. +-----------+-------------------------------------+
  396. | *Getter* | is_highlight_current_line_enabled() |
  397. +-----------+-------------------------------------+
  398. If ``true``, the line containing the cursor is highlighted.
  399. .. _class_TextEdit_property_override_selected_font_color:
  400. - :ref:`bool<class_bool>` **override_selected_font_color**
  401. +-----------+-----------------------------------------+
  402. | *Default* | false |
  403. +-----------+-----------------------------------------+
  404. | *Setter* | set_override_selected_font_color(value) |
  405. +-----------+-----------------------------------------+
  406. | *Getter* | is_overriding_selected_font_color() |
  407. +-----------+-----------------------------------------+
  408. .. _class_TextEdit_property_readonly:
  409. - :ref:`bool<class_bool>` **readonly**
  410. +-----------+---------------------+
  411. | *Default* | false |
  412. +-----------+---------------------+
  413. | *Setter* | set_readonly(value) |
  414. +-----------+---------------------+
  415. | *Getter* | is_readonly() |
  416. +-----------+---------------------+
  417. If ``true``, read-only mode is enabled. Existing text cannot be modified and new text cannot be added.
  418. .. _class_TextEdit_property_show_line_numbers:
  419. - :ref:`bool<class_bool>` **show_line_numbers**
  420. +-----------+--------------------------------+
  421. | *Default* | false |
  422. +-----------+--------------------------------+
  423. | *Setter* | set_show_line_numbers(value) |
  424. +-----------+--------------------------------+
  425. | *Getter* | is_show_line_numbers_enabled() |
  426. +-----------+--------------------------------+
  427. If ``true``, line numbers are displayed to the left of the text.
  428. .. _class_TextEdit_property_smooth_scrolling:
  429. - :ref:`bool<class_bool>` **smooth_scrolling**
  430. +-----------+---------------------------------+
  431. | *Default* | false |
  432. +-----------+---------------------------------+
  433. | *Setter* | set_smooth_scroll_enable(value) |
  434. +-----------+---------------------------------+
  435. | *Getter* | is_smooth_scroll_enabled() |
  436. +-----------+---------------------------------+
  437. If ``true``, sets the ``step`` of the scrollbars to ``0.25`` which results in smoother scrolling.
  438. .. _class_TextEdit_property_syntax_highlighting:
  439. - :ref:`bool<class_bool>` **syntax_highlighting**
  440. +-----------+------------------------------+
  441. | *Default* | false |
  442. +-----------+------------------------------+
  443. | *Setter* | set_syntax_coloring(value) |
  444. +-----------+------------------------------+
  445. | *Getter* | is_syntax_coloring_enabled() |
  446. +-----------+------------------------------+
  447. If ``true``, any custom color properties that have been set for this ``TextEdit`` will be visible.
  448. .. _class_TextEdit_property_text:
  449. - :ref:`String<class_String>` **text**
  450. +-----------+-----------------+
  451. | *Default* | "" |
  452. +-----------+-----------------+
  453. | *Setter* | set_text(value) |
  454. +-----------+-----------------+
  455. | *Getter* | get_text() |
  456. +-----------+-----------------+
  457. String value of the ``TextEdit``.
  458. .. _class_TextEdit_property_v_scroll_speed:
  459. - :ref:`float<class_float>` **v_scroll_speed**
  460. +-----------+---------------------------+
  461. | *Default* | 80.0 |
  462. +-----------+---------------------------+
  463. | *Setter* | set_v_scroll_speed(value) |
  464. +-----------+---------------------------+
  465. | *Getter* | get_v_scroll_speed() |
  466. +-----------+---------------------------+
  467. Vertical scroll sensitivity.
  468. .. _class_TextEdit_property_wrap_enabled:
  469. - :ref:`bool<class_bool>` **wrap_enabled**
  470. +-----------+-------------------------+
  471. | *Default* | false |
  472. +-----------+-------------------------+
  473. | *Setter* | set_wrap_enabled(value) |
  474. +-----------+-------------------------+
  475. | *Getter* | is_wrap_enabled() |
  476. +-----------+-------------------------+
  477. If ``true``, enables text wrapping when it goes beyond the edge of what is visible.
  478. Method Descriptions
  479. -------------------
  480. .. _class_TextEdit_method_add_color_region:
  481. - 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 **)**
  482. Adds color region (given the delimiters) and its colors.
  483. .. _class_TextEdit_method_add_keyword_color:
  484. - void **add_keyword_color** **(** :ref:`String<class_String>` keyword, :ref:`Color<class_Color>` color **)**
  485. Adds a ``keyword`` and its :ref:`Color<class_Color>`.
  486. .. _class_TextEdit_method_can_fold:
  487. - :ref:`bool<class_bool>` **can_fold** **(** :ref:`int<class_int>` line **)** const
  488. Returns if the given line is foldable, that is, it has indented lines right below it.
  489. .. _class_TextEdit_method_center_viewport_to_cursor:
  490. - void **center_viewport_to_cursor** **(** **)**
  491. .. _class_TextEdit_method_clear_colors:
  492. - void **clear_colors** **(** **)**
  493. Clears all the syntax coloring information.
  494. .. _class_TextEdit_method_clear_undo_history:
  495. - void **clear_undo_history** **(** **)**
  496. Clears the undo history.
  497. .. _class_TextEdit_method_copy:
  498. - void **copy** **(** **)**
  499. Copy's the current text selection.
  500. .. _class_TextEdit_method_cursor_get_column:
  501. - :ref:`int<class_int>` **cursor_get_column** **(** **)** const
  502. Returns the column the editing cursor is at.
  503. .. _class_TextEdit_method_cursor_get_line:
  504. - :ref:`int<class_int>` **cursor_get_line** **(** **)** const
  505. Returns the line the editing cursor is at.
  506. .. _class_TextEdit_method_cursor_set_column:
  507. - void **cursor_set_column** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` adjust_viewport=true **)**
  508. Moves the cursor at the specified ``column`` index.
  509. If ``adjust_viewport`` is set to true, the viewport will center at the cursor position after the move occurs.
  510. .. _class_TextEdit_method_cursor_set_line:
  511. - 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 **)**
  512. Moves the cursor at the specified ``line`` index.
  513. If ``adjust_viewport`` is set to true, the viewport will center at the cursor position after the move occurs.
  514. 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>`.
  515. .. _class_TextEdit_method_cut:
  516. - void **cut** **(** **)**
  517. Cut's the current selection.
  518. .. _class_TextEdit_method_deselect:
  519. - void **deselect** **(** **)**
  520. Deselects the current selection.
  521. .. _class_TextEdit_method_fold_all_lines:
  522. - void **fold_all_lines** **(** **)**
  523. Folds all lines that are possible to be folded (see :ref:`can_fold<class_TextEdit_method_can_fold>`).
  524. .. _class_TextEdit_method_fold_line:
  525. - void **fold_line** **(** :ref:`int<class_int>` line **)**
  526. Folds the given line, if possible (see :ref:`can_fold<class_TextEdit_method_can_fold>`).
  527. .. _class_TextEdit_method_get_breakpoints:
  528. - :ref:`Array<class_Array>` **get_breakpoints** **(** **)** const
  529. Returns an array containing the line number of each breakpoint.
  530. .. _class_TextEdit_method_get_keyword_color:
  531. - :ref:`Color<class_Color>` **get_keyword_color** **(** :ref:`String<class_String>` keyword **)** const
  532. Returns the :ref:`Color<class_Color>` of the specified ``keyword``.
  533. .. _class_TextEdit_method_get_line:
  534. - :ref:`String<class_String>` **get_line** **(** :ref:`int<class_int>` line **)** const
  535. Returns the text of a specific line.
  536. .. _class_TextEdit_method_get_line_count:
  537. - :ref:`int<class_int>` **get_line_count** **(** **)** const
  538. Returns the amount of total lines in the text.
  539. .. _class_TextEdit_method_get_menu:
  540. - :ref:`PopupMenu<class_PopupMenu>` **get_menu** **(** **)** const
  541. Returns the :ref:`PopupMenu<class_PopupMenu>` of this ``TextEdit``. By default, this menu is displayed when right-clicking on the ``TextEdit``.
  542. .. _class_TextEdit_method_get_selection_from_column:
  543. - :ref:`int<class_int>` **get_selection_from_column** **(** **)** const
  544. Returns the selection begin column.
  545. .. _class_TextEdit_method_get_selection_from_line:
  546. - :ref:`int<class_int>` **get_selection_from_line** **(** **)** const
  547. Returns the selection begin line.
  548. .. _class_TextEdit_method_get_selection_text:
  549. - :ref:`String<class_String>` **get_selection_text** **(** **)** const
  550. Returns the text inside the selection.
  551. .. _class_TextEdit_method_get_selection_to_column:
  552. - :ref:`int<class_int>` **get_selection_to_column** **(** **)** const
  553. Returns the selection end column.
  554. .. _class_TextEdit_method_get_selection_to_line:
  555. - :ref:`int<class_int>` **get_selection_to_line** **(** **)** const
  556. Returns the selection end line.
  557. .. _class_TextEdit_method_get_word_under_cursor:
  558. - :ref:`String<class_String>` **get_word_under_cursor** **(** **)** const
  559. Returns a :ref:`String<class_String>` text with the word under the mouse cursor location.
  560. .. _class_TextEdit_method_has_keyword_color:
  561. - :ref:`bool<class_bool>` **has_keyword_color** **(** :ref:`String<class_String>` keyword **)** const
  562. Returns whether the specified ``keyword`` has a color set to it or not.
  563. .. _class_TextEdit_method_insert_text_at_cursor:
  564. - void **insert_text_at_cursor** **(** :ref:`String<class_String>` text **)**
  565. Insert the specified text at the cursor position.
  566. .. _class_TextEdit_method_is_folded:
  567. - :ref:`bool<class_bool>` **is_folded** **(** :ref:`int<class_int>` line **)** const
  568. Returns whether the line at the specified index is folded or not.
  569. .. _class_TextEdit_method_is_line_hidden:
  570. - :ref:`bool<class_bool>` **is_line_hidden** **(** :ref:`int<class_int>` line **)** const
  571. Returns whether the line at the specified index is hidden or not.
  572. .. _class_TextEdit_method_is_selection_active:
  573. - :ref:`bool<class_bool>` **is_selection_active** **(** **)** const
  574. Returns ``true`` if the selection is active.
  575. .. _class_TextEdit_method_menu_option:
  576. - void **menu_option** **(** :ref:`int<class_int>` option **)**
  577. Triggers a right-click menu action by the specified index. See :ref:`MenuItems<enum_TextEdit_MenuItems>` for a list of available indexes.
  578. .. _class_TextEdit_method_paste:
  579. - void **paste** **(** **)**
  580. Paste the current selection.
  581. .. _class_TextEdit_method_redo:
  582. - void **redo** **(** **)**
  583. Perform redo operation.
  584. .. _class_TextEdit_method_remove_breakpoints:
  585. - void **remove_breakpoints** **(** **)**
  586. Removes all the breakpoints. This will not fire the :ref:`breakpoint_toggled<class_TextEdit_signal_breakpoint_toggled>` signal.
  587. .. _class_TextEdit_method_search:
  588. - :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
  589. Perform a search inside the text. Search flags can be specified in the``SEARCH_*`` enum.
  590. .. _class_TextEdit_method_select:
  591. - 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 **)**
  592. Perform selection, from line/column to line/column.
  593. .. _class_TextEdit_method_select_all:
  594. - void **select_all** **(** **)**
  595. Select all the text.
  596. .. _class_TextEdit_method_set_line_as_hidden:
  597. - void **set_line_as_hidden** **(** :ref:`int<class_int>` line, :ref:`bool<class_bool>` enable **)**
  598. If ``true``, hides the line of the specified index.
  599. .. _class_TextEdit_method_toggle_fold_line:
  600. - void **toggle_fold_line** **(** :ref:`int<class_int>` line **)**
  601. Toggle the folding of the code block at the given line.
  602. .. _class_TextEdit_method_undo:
  603. - void **undo** **(** **)**
  604. Perform undo operation.
  605. .. _class_TextEdit_method_unfold_line:
  606. - void **unfold_line** **(** :ref:`int<class_int>` line **)**
  607. Unfolds the given line, if folded.
  608. .. _class_TextEdit_method_unhide_all_lines:
  609. - void **unhide_all_lines** **(** **)**
  610. Unhide all lines that were previously set to hidden by :ref:`set_line_as_hidden<class_TextEdit_method_set_line_as_hidden>`.