class_textedit.rst 52 KB

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