class_textedit - dragonsoulz/godot GitHub Wiki

TextEdit

####Inherits: Control ####Category: Core

Brief Description

Multiline text editing control.

Member Functions

Signals

  • text_changed ( )
  • cursor_changed ( )
  • request_completion ( String keyword, int line )

Numeric Constants

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

Description

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

Member Function Description

set_text

  • void set_text ( String text )

Set the entire text.

insert_text_at_cursor

  • void insert_text_at_cursor ( String text )

Insert a given text at the cursor position.

get_line_count

  • int get_line_count ( ) const

Return the amount of total lines in the text.

get_text

Return the whole text.

get_line

Return the text of a specific line.

cursor_set_column

  • void cursor_set_column ( int column )

Set the current column of the text editor.

cursor_set_line

  • void cursor_set_line ( int line )

Set the current line of the text editor.

cursor_get_column

  • int cursor_get_column ( ) const

Return the column the editing cursor is at.

cursor_get_line

  • int cursor_get_line ( ) const

Return the line the editing cursor is at.

set_readonly

  • void set_readonly ( bool enable )

Set the text editor as read-only. Text can be displayed but not edited.

set_wrap

  • void set_wrap ( bool enable )

Enable text wrapping when it goes beyond he edge of what is visible.

set_max_chars

  • void set_max_chars ( int amount )

Set the maximum amount of characters editable.

cut

  • void cut ( )

Cut the current selection.

copy

  • void copy ( )

Copy the current selection.

paste

  • void paste ( )

Paste the current selection.

select_all

  • void select_all ( )

Select all the text.

select

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

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

is_selection_active

  • bool is_selection_active ( ) const

Return true if the selection is active.

get_selection_from_line

  • int get_selection_from_line ( ) const

Return the selection begin line.

get_selection_from_column

  • int get_selection_from_column ( ) const

Return the selection begin column.

get_selection_to_line

  • int get_selection_to_line ( ) const

Return the selection end line.

get_selection_to_column

  • int get_selection_to_column ( ) const

Return the selection end column.

get_selection_text

  • String get_selection_text ( ) const

Return the text inside the selection.

search

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

undo

  • void undo ( )

Perform undo operation.

redo

  • void redo ( )

Perform redo operation.

clear_undo_history

  • void clear_undo_history ( )

Clear the undo history.

set_syntax_coloring

  • void set_syntax_coloring ( bool enable )

Set to enable the syntax coloring.

is_syntax_coloring_enabled

  • bool is_syntax_coloring_enabled ( ) const

Return true if the syntax coloring is enabled.

add_keyword_color

  • void add_keyword_color ( String keyword, Color color )

Add a keyword and it's color.

add_color_region

Add color region (given the delimiters) and it's colors.

set_symbol_color

  • void set_symbol_color ( Color color )

Set the color for symbols.

set_custom_bg_color

  • void set_custom_bg_color ( Color color )

Set a custom background color. A background color with alpha==0 disables this.

clear_colors

  • void clear_colors ( )

Clear all the syntax coloring information.