TextEdit

Inherits: Control < CanvasItem < Node < Object

Category: Core

Brief Description

Multiline text editing control.

Methods

void add_color_region ( String begin_key, String end_key, Color color, bool line_only=false )
void add_keyword_color ( String keyword, Color color )
bool can_fold ( int line ) const
void clear_colors ( )
void clear_undo_history ( )
void copy ( )
int cursor_get_column ( ) const
int cursor_get_line ( ) const
void cursor_set_column ( int column, bool adjust_viewport=true )
void cursor_set_line ( int line, bool adjust_viewport=true, bool can_be_hidden=true, int wrap_index=0 )
void cut ( )
void deselect ( )
void fold_all_lines ( )
void fold_line ( int line )
Array get_breakpoints ( ) const
Color get_keyword_color ( String keyword ) const
String get_line ( int line ) const
int get_line_count ( ) const
PopupMenu get_menu ( ) const
int get_selection_from_column ( ) const
int get_selection_from_line ( ) const
String get_selection_text ( ) const
int get_selection_to_column ( ) const
int get_selection_to_line ( ) const
String get_word_under_cursor ( ) const
bool has_keyword_color ( String keyword ) const
void insert_text_at_cursor ( String text )
bool is_folded ( int line ) const
bool is_line_hidden ( int line ) const
bool is_selection_active ( ) const
void menu_option ( int option )
void paste ( )
void redo ( )
void remove_breakpoints ( )
PoolIntArray search ( String key, int flags, int from_line, int from_column ) const
void select ( int from_line, int from_column, int to_line, int to_column )
void select_all ( )
void set_line_as_hidden ( int line, bool enable )
void toggle_fold_line ( int line )
void undo ( )
void unfold_line ( int line )
void unhide_all_lines ( )

Theme Properties

Color background_color
Color brace_mismatch_color
Color breakpoint_color
Color caret_background_color
Color caret_color
Color code_folding_color
StyleBox completion
Color completion_background_color
Color completion_existing_color
Color completion_font_color
int completion_lines
int completion_max_width
Color completion_scroll_color
int completion_scroll_width
Color completion_selected_color
Color current_line_color
StyleBox focus
Font font
Color font_color
Color font_color_selected
Color function_color
Color line_number_color
int line_spacing
Color mark_color
Color member_variable_color
StyleBox normal
Color number_color
StyleBox read_only
Color safe_line_number_color
Color selection_color
Color symbol_color
Texture tab
Color word_highlighted_color

Signals

  • breakpoint_toggled ( int row )

Emitted when a breakpoint is placed via the breakpoint gutter.

  • cursor_changed ( )

Emitted when the cursor changes.

  • request_completion ( )
  • text_changed ( )

Emitted when the text changes.

Enumerations

enum MenuItems:

  • MENU_CUT = 0 — Cuts (Copies and clears) the selected text.
  • MENU_COPY = 1 — Copies the selected text.
  • MENU_PASTE = 2 — Pastes the clipboard text over the selected text (or at the cursor’s position).
  • MENU_CLEAR = 3 — Erases the whole TextEdit text.
  • MENU_SELECT_ALL = 4 — Selects the whole TextEdit text.
  • MENU_UNDO = 5 — Undoes the previous action.
  • MENU_MAX = 6

enum SearchFlags:

  • SEARCH_MATCH_CASE = 1 — Match case when searching.
  • SEARCH_WHOLE_WORDS = 2 — Match whole words when searching.
  • SEARCH_BACKWARDS = 4 — Search from end to beginning.

Description

TextEdit is meant for editing large, multiline text. It also has facilities for editing code, such as syntax highlighting support and multiple levels of undo/redo.

Property Descriptions

  • bool breakpoint_gutter
Setter set_breakpoint_gutter_enabled(value)
Getter is_breakpoint_gutter_enabled()

If true the breakpoint gutter is visible.

Setter cursor_set_blink_enabled(value)
Getter cursor_get_blink_enabled()

If true the caret (visual cursor) blinks.

Setter cursor_set_blink_speed(value)
Getter cursor_get_blink_speed()

Duration (in seconds) of a caret’s blinking cycle.

  • bool caret_block_mode
Setter cursor_set_block_mode(value)
Getter cursor_is_block_mode()

If true the caret displays as a rectangle.

If false the caret displays as a bar.

  • bool caret_moving_by_right_click
Setter set_right_click_moves_caret(value)
Getter is_right_click_moving_caret()

If true a right click moves the cursor at the mouse position before displaying the context menu.

If false the context menu disregards mouse location.

  • bool context_menu_enabled
Setter set_context_menu_enabled(value)
Getter is_context_menu_enabled()

If true a right click displays the context menu.

  • int hiding_enabled
Setter set_hiding_enabled(value)
Getter is_hiding_enabled()
  • bool highlight_all_occurrences
Setter set_highlight_all_occurrences(value)
Getter is_highlight_all_occurrences_enabled()
  • bool highlight_current_line
Setter set_highlight_current_line(value)
Getter is_highlight_current_line_enabled()

If true the line containing the cursor is highlighted.

  • bool override_selected_font_color
Setter set_override_selected_font_color(value)
Getter is_overriding_selected_font_color()
Setter set_readonly(value)
Getter is_readonly()

If true read-only mode is enabled. Existing text cannot be modified and new text cannot be added.

  • bool show_line_numbers
Setter set_show_line_numbers(value)
Getter is_show_line_numbers_enabled()

If true line numbers are displayed to the left of the text.

  • bool smooth_scrolling
Setter set_smooth_scroll_enable(value)
Getter is_smooth_scroll_enabled()
  • bool syntax_highlighting
Setter set_syntax_coloring(value)
Getter is_syntax_coloring_enabled()
Setter set_text(value)
Getter get_text()

String value of the TextEdit.

Setter set_v_scroll_speed(value)
Getter get_v_scroll_speed()

If true, enables text wrapping when it goes beyond he edge of what is visible.

Setter set_wrap_enabled(value)
Getter is_wrap_enabled()

Method Descriptions

Add color region (given the delimiters) and its colors.

  • void add_keyword_color ( String keyword, Color color )

Add a keyword and its color.

  • void clear_colors ( )

Clear all the syntax coloring information.

  • void clear_undo_history ( )

Clear the undo history.

  • void copy ( )

Copy the current selection.

  • int cursor_get_column ( ) const

Return the column the editing cursor is at.

  • int cursor_get_line ( ) const

Return the line the editing cursor is at.

  • void cursor_set_column ( int column, bool adjust_viewport=true )
  • void cursor_set_line ( int line, bool adjust_viewport=true, bool can_be_hidden=true, int wrap_index=0 )
  • void cut ( )

Cut the current selection.

  • void deselect ( )

Clears the current selection.

  • void fold_all_lines ( )
  • void fold_line ( int line )
  • Array get_breakpoints ( ) const

Return an array containing the line number of each breakpoint.

Return the text of a specific line.

  • int get_line_count ( ) const

Return the amount of total lines in the text.

  • int get_selection_from_column ( ) const

Return the selection begin column.

  • int get_selection_from_line ( ) const

Return the selection begin line.

  • String get_selection_text ( ) const

Return the text inside the selection.

  • int get_selection_to_column ( ) const

Return the selection end column.

  • int get_selection_to_line ( ) const

Return the selection end line.

  • String get_word_under_cursor ( ) const
  • void insert_text_at_cursor ( String text )

Insert a given text at the cursor position.

  • bool is_folded ( int line ) const
  • bool is_line_hidden ( int line ) const
  • bool is_selection_active ( ) const

Return true if the selection is active.

  • void menu_option ( int option )
  • void paste ( )

Paste the current selection.

  • void redo ( )

Perform redo operation.

  • void remove_breakpoints ( )

Removes all the breakpoints (without firing “breakpoint_toggled” signal).

Perform a search inside the text. Search flags can be specified in the SEARCH_* enum.

  • void select ( int from_line, int from_column, int to_line, int to_column )

Perform selection, from line/column to line/column.

  • void select_all ( )

Select all the text.

  • void set_line_as_hidden ( int line, bool enable )
  • void toggle_fold_line ( int line )

Toggle the folding of the code block at the given line.

  • void undo ( )

Perform undo operation.

  • void unfold_line ( int line )
  • void unhide_all_lines ( )