TextEdit

    Category: Core

    Multiline text editing control.

    Properties

    Methods

    void ( String begin_key, end_key, Color color, line_only=false )
    voidadd_keyword_color ( keyword, Color color )
    can_fold ( line ) const
    voidclear_colors ( )
    void ( )
    voidcopy ( )
    cursor_get_column ( ) const
    cursor_get_line ( ) const
    void ( int column, adjust_viewport=true )
    voidcursor_set_line ( line, bool adjust_viewport=true, can_be_hidden=true, int wrap_index=0 )
    void ( )
    voiddeselect ( )
    void ( )
    voidfold_line ( line )
    Array ( ) const
    Color ( String keyword ) const
    get_line ( line ) const
    int ( ) const
    PopupMenu ( ) const
    int ( ) const
    int ( ) const
    String ( ) const
    int ( ) const
    int ( ) const
    String ( ) const
    bool ( String keyword ) const
    void ( String text )
    is_folded ( line ) const
    bool ( int line ) const
    is_selection_active ( ) const
    void ( int option )
    void ( )
    voidredo ( )
    void ( )
    PoolIntArray ( String key, flags, int from_line, from_column ) const
    voidselect ( from_line, int from_column, to_line, int to_column )
    void ( )
    voidset_line_as_hidden ( line, bool enable )
    void ( int line )
    void ( )
    voidunfold_line ( line )
    voidunhide_all_lines ( )
    background_color
    Colorbrace_mismatch_color
    breakpoint_color
    Colorcaret_background_color
    caret_color
    Colorcode_folding_color
    completion
    Colorcompletion_background_color
    completion_existing_color
    Colorcompletion_font_color
    completion_lines
    intcompletion_max_width
    completion_scroll_color
    intcompletion_scroll_width
    completion_selected_color
    Colorcurrent_line_color
    focus
    Fontfont
    font_color
    Colorfont_color_selected
    function_color
    Colorline_number_color
    line_spacing
    Colormark_color
    member_variable_color
    StyleBoxnormal
    number_color
    StyleBoxread_only
    safe_line_number_color
    Colorselection_color
    symbol_color
    Texturetab
    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 ( )

    • symbol_lookup ( symbol, int row, column )

    • text_changed ( )

    Emitted when the text changes.

    Enumerations

    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.

    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 text.
    • MENU_UNDO = 5 — Undoes the previous action.
    • MENU_REDO = 6 — Redoes the previous action.
    • MENU_MAX = 7 — Represents the size of the MenuItems enum.

    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

    • breakpoint_gutter
    Setterset_breakpoint_gutter_enabled(value)
    Getteris_breakpoint_gutter_enabled()

    If , the breakpoint gutter is visible.


    Settercursor_set_blink_enabled(value)
    Gettercursor_get_blink_enabled()

    If true, the caret (visual cursor) blinks.


    Settercursor_set_blink_speed(value)
    Gettercursor_get_blink_speed()

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


    • caret_block_mode

    If true, the caret displays as a rectangle.

    If false, the caret displays as a bar.


    • bool caret_moving_by_right_click
    Setterset_right_click_moves_caret(value)
    Getteris_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.


    • context_menu_enabled
    Setterset_context_menu_enabled(value)
    Getteris_context_menu_enabled()

    If true, a right click displays the context menu.


    • int hiding_enabled
    Setterset_hiding_enabled(value)
    Getteris_hiding_enabled()

    • highlight_all_occurrences
    Setterset_highlight_all_occurrences(value)
    Getteris_highlight_all_occurrences_enabled()

    If true, all occurrences of the selected text will be highlighted.


    • bool highlight_current_line
    Setterset_highlight_current_line(value)
    Getteris_highlight_current_line_enabled()

    If true, the line containing the cursor is highlighted.


    • override_selected_font_color

    Setterset_readonly(value)
    Getteris_readonly()

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


    • show_line_numbers
    Setterset_show_line_numbers(value)
    Getteris_show_line_numbers_enabled()

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


    • bool smooth_scrolling
    Setterset_smooth_scroll_enable(value)
    Getteris_smooth_scroll_enabled()

    If true, sets the step of the scrollbars to 0.25 which results in smoother scrolling.


    • syntax_highlighting
    Setterset_syntax_coloring(value)
    Getteris_syntax_coloring_enabled()

    Setterset_text(value)
    Getterget_text()

    String value of the .


    Vertical scroll sensitivity.


    • wrap_enabled
    Setterset_wrap_enabled(value)
    Getteris_wrap_enabled()

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

    Method Descriptions

    • void add_color_region ( String begin_key, end_key, Color color, line_only=false )

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


    • void add_keyword_color ( String keyword, color )

    Add a keyword and its Color.


    • can_fold ( int line ) const

    • void clear_colors ( )

    Clears all the syntax coloring information.


    • void clear_undo_history ( )

    Clears the undo history.


    • void copy ( )

    Copy’s the current text selection.


    • cursor_get_column ( ) const

    Returns the column the editing cursor is at.


    • int cursor_get_line ( ) const

    Returns the line the editing cursor is at.


    • void cursor_set_column ( column, bool adjust_viewport=true )

    Moves the cursor at the specified column index.

    If adjust_viewport is set to true, the viewport will center at the cursor position after the move occurs. Default value is true.


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

    Moves the cursor at the specified index.

    If adjust_viewport is set to true, the viewport will center at the cursor position after the move occurs. Default value is true.

    If can_be_hidden is set to true, the specified line can be hidden using . Default value is true.


    • void cut ( )

    Cut’s the current selection.


    • void deselect ( )

    Deselects the current selection.


    • void fold_all_lines ( )


    • Array get_breakpoints ( ) const

    Returns an array containing the line number of each breakpoint.


    • get_keyword_color ( String keyword ) const

    Returns the of the specified keyword.


    • String get_line ( line ) const

    Returns the text of a specific line.


    • int get_line_count ( ) const

    Returns the amount of total lines in the text.


    • get_menu ( ) const

    • int get_selection_from_column ( ) const

    • get_selection_from_line ( ) const

    Returns the selection begin line.


    • String get_selection_text ( ) const

    Returns the text inside the selection.


    • get_selection_to_column ( ) const

    Returns the selection end column.


    • int get_selection_to_line ( ) const

    Returns the selection end line.


    • get_word_under_cursor ( ) const

    Returns a String text with the word under the mouse cursor location.


    • has_keyword_color ( String keyword ) const

    Returns whether the specified keyword has a color set to it or not.


    • void insert_text_at_cursor ( text )

    Insert the specified text at the cursor position.


    • bool is_folded ( line ) const

    Returns whether the line at the specified index is folded or not.


    • bool is_line_hidden ( line ) const

    Returns whether the line at the specified index is hidden or not.


    • bool is_selection_active ( ) const

    Returns true if the selection is active.


    • void menu_option ( option )

    Triggers a right click menu action by the specified index. See MenuItems for a list of available indexes.


    • void paste ( )

    Paste the current selection.


    • void redo ( )

    Perform redo operation.


    • void remove_breakpoints ( )

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


    • search ( String key, flags, int from_line, from_column ) const

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


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

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


    • void select_all ( )

    Select all the text.


    • void set_line_as_hidden ( int line, enable )

    If true, hides the line of the specified index.


    • 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 ( line )

    Unhide all lines that were previously set to hidden by set_line_as_hidden.