TextEdit

Inherits: Control < CanvasItem < Node < Object

类别: 核心

简要说明

多行文本编辑控件。

方法

无效

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

无效

add_keyword_color ( String keyword, Color color )

bool

can_fold ( int line ) const

无效

center_viewport_to_cursor ( )

无效

clear_colors ( )

无效

clear_undo_history ( )

无效

copy ( )

int

cursor_get_column ( ) const

int

cursor_get_line ( ) const

无效

cursor_set_column ( int column, bool adjust_viewport=true )

无效

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

无效

cut ( )

无效

deselect ( )

无效

fold_all_lines ( )

无效

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

无效

insert_text_at_cursor ( String text )

bool

is_folded ( int line ) const

bool

is_line_hidden ( int line ) const

bool

is_selection_active ( ) const

无效

menu_option ( int option )

无效

paste ( )

无效

redo ( )

无效

remove_breakpoints ( )

PoolIntArray

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

无效

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

无效

select_all ( )

无效

set_line_as_hidden ( int line, bool enable )

无效

toggle_fold_line ( int line )

无效

undo ( )

无效

unfold_line ( int line )

无效

unhide_all_lines ( )

主题属性

Color

background_color

颜色(0,0,0,1)

Color

bookmark_color

颜色(0.08、0.49、0.98、1)

Color

brace_mismatch_color

颜色(1,0.2,0.2,1)

Color

breakpoint_color

颜色(0.8、0.8、0.4、0.2)

Color

caret_background_color

颜色(0,0,0,1)

Color

caret_color

颜色(0.88、0.88、0.88、1)

Color

code_folding_color

颜色(0.8、0.8、0.8、0.8)

StyleBox

完成

Color

completion_background_color

颜色(0.17、0.16、0.2、1)

Color

completion_existing_color

颜色(0.87、0.87、0.87、0.13)

Color

completion_font_color

颜色(0.67、0.67、0.67、1)

int

completion_lines

7

int

completion_max_width

50

Color

completion_scroll_color

颜色(1,1,1,1)

int

completion_scroll_width

3

Color

completion_selected_color

颜色(0.26、0.26、0.27、1)

Color

current_line_color

颜色(0.25、0.25、0.26、0.8)

Color

executing_line_color

颜色(0.2、0.8、0.2、0.4)

StyleBox

集中

Texture

折叠

Texture

折叠

Font

字体

Color

font_color

颜色(0.88、0.88、0.88、1)

Color

font_color_readonly

颜色(0.88、0.88、0.88、0.5)

Color

font_color_selected

颜色(0,0,0,1)

Color

function_color

颜色(0.4、0.64、0.81、1)

Color

line_number_color

颜色(0.67、0.67、0.67、0.4)

int

line_spacing

4

Color

mark_color

颜色(1,0.4,0.4,0.4)

Color

member_variable_color

颜色(0.9、0.31、0.35、1)

StyleBox

正常的

Color

number_color

颜色(0.92、0.58、0.2、1)

StyleBox

read_only

Color

safe_line_number_color

颜色(0.67、0.78、0.67、0.6)

Color

selection_color

颜色(0.49、0.49、0.49、1)

Texture

空间

Color

symbol_color

颜色(0.94、0.94、0.94、1)

Texture

标签

Color

word_highlighted_color

颜色(0.8、0.9、0.9、0.15)

信号

  • breakpoint_toggled ( int row )

通过断点槽放置断点时发出。

  • cursor_changed ( )

光标更改时发出。

单击信息图标时发出。

  • request_completion ( )

  • text_changed ( )

文本更改时发出。

枚举

枚举 SearchFlags

  • SEARCH_MATCH_CASE = 1 ---搜索时匹配大小写。

  • SEARCH_WHOLE_WORDS = 2 ---搜索时匹配整个单词。

  • SEARCH_BACKWARDS = 4 ---从头到尾搜索。

枚举 MenuItems

  • MENU_CUT = 0 ---剪切(复制和清除)所选文本。

  • MENU_COPY = 1 ---复制所选文本。

  • MENU_PASTE = 2 ---将剪贴板文本粘贴到所选文本上(或在光标位置)。

  • MENU_CLEAR = 3 ---抹去整个 TextEdit 文本。

  • MENU_SELECT_ALL = 4 ---选择整个 TextEdit 文本。

  • MENU_UNDO = 5 ---撤消上一个操作。

  • MENU_REDO = 6 ---重做上一个操作。

  • MENU_MAX = 7 ---表示 MenuItems 枚举。

描述

textedit用于编辑大型多行文本。它还具有编辑代码的功能,例如语法突出显示支持和多级撤消/重做。

属性描述

  • bool breakpoint_gutter

违约

设定器

设置中断点槽启用(值)

吸气剂

是否启用了中断点沟槽()。

如果 true ,断点槽可见。

违约

设定器

光标设置闪烁启用(值)

吸气剂

光标闪烁(启用)

如果 true ,插入符号(可视光标)闪烁。

违约

0.65

设定器

光标设置闪烁速度(值)

吸气剂

光标闪烁速度

插入符号闪烁周期的持续时间(秒)。

  • bool caret_block_mode

违约

设定器

光标设置块模式(值)

吸气剂

光标_为_块_模式()。

如果 true ,插入符号显示为矩形。

如果 false ,插入符号显示为一个条形。

  • bool caret_moving_by_right_click

违约

设定器

设置右键单击移动插入符号(值)

吸气剂

用鼠标右键单击移动插入符号()。

如果 true ,单击鼠标右键将光标移动到鼠标位置,然后显示上下文菜单。

如果 false ,上下文菜单忽略鼠标位置。

  • bool context_menu_enabled

违约

设定器

设置上下文菜单启用(值)

吸气剂

_-context_-menu_-enabled()是否已启用?

如果 true 单击鼠标右键将显示上下文菜单。

违约

设定器

设置绘制空格(值)

吸气剂

正在绘制空格()。

如果 true “空格”字符将具有可见的表示形式。

违约

设定器

设置“绘制”选项卡(值)

吸气剂

正在绘制选项卡()。

如果 true “tab”字符将具有可见的表示形式。

违约

设定器

设置“绘制折叠”装订线(值)

吸气剂

正在绘制折叠槽()。

如果 true ,折叠槽可见。这将启用缩进行的折叠组。

  • bool hiding_enabled

违约

设定器

设置隐藏启用(值)

吸气剂

是否启用了隐藏功能()。

如果 true ,已设置为隐藏的所有行 set_line_as_hidden ,将不可见。

  • bool highlight_all_occurrences

违约

设定器

设置u突出显示u所有事件(值)

吸气剂

_highlight_all_occurrents_enabled()是否已启用?

如果 true ,所选文本的所有匹配项都将突出显示。

  • bool highlight_current_line

违约

设定器

设置突出显示当前行(值)

吸气剂

_highlight_current_line_enabled()是否已启用?

如果 true ,将突出显示包含光标的行。

  • bool override_selected_font_color

违约

设定器

设置“覆盖”选定的“字体”颜色(值)

吸气剂

是否覆盖所选字体颜色()。

违约

设定器

设置只读(值)

吸气剂

为只读()

如果 true ,启用只读模式。无法修改现有文本,也无法添加新文本。

  • bool show_line_numbers

违约

设定器

设置显示线号(值)

吸气剂

_show_line_numbers_enabled()是否已启用?

如果 true ,行号显示在文本左侧。

  • bool smooth_scrolling

违约

设定器

设置“平滑滚动”启用(值)

吸气剂

是否启用了“平滑滚动”()

如果 true ,设置 step 滚动条的 0.25 从而使滚动更平滑。

  • bool syntax_highlighting

违约

设定器

设置语法着色(值)

吸气剂

是否启用了句法着色()。

如果 true ,已为此设置的任何自定义颜色属性 TextEdit 将可见。

违约

设定器

设置文本(值)

吸气剂

获取文本()

的字符串值 TextEdit .

违约

80.0

设定器

设置滚动速度(值)

吸气剂

获取滚动速度

垂直滚动灵敏度。

违约

设定器

设置“自动换行”启用(值)

吸气剂

是否启用了“自动换行”()

如果 true ,当文本超出可见边缘时启用文本换行。

方法说明

添加颜色区域(给定分隔符)及其颜色。

  • void add_keyword_color ( String keyword, Color color )

添加一个 keyword 及其 Color .

如果给定行是可折叠的,即其正下方有缩进行,则返回。

  • void center_viewport_to_cursor ( )

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

将光标移动到指定位置 column 索引。

如果 adjust_viewport 如果设置为“真”,则在移动发生后,视区将以光标位置为中心。

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

将光标移动到指定位置 line 索引。

如果 adjust_viewport 如果设置为“真”,则在移动发生后,视区将以光标位置为中心。

如果 can_be_hidden 设置为true,指定的 line 可以使用隐藏 set_line_as_hidden .

  • void cut ( )

剪切当前所选内容。

  • void deselect ( )

取消选择当前选择。

  • void fold_all_lines ( )

折叠所有可能折叠的行(请参见 can_fold

  • void fold_line ( int line )

如果可能,折叠给定的行(请参见 can_fold

  • Array get_breakpoints ( ) const

返回一个数组,该数组包含每个断点的行号。

返回 Color 指定的 keyword .

返回特定行的文本。

  • int get_line_count ( ) const

返回文本中的总行数。

返回 PopupMenu 其中 TextEdit . 默认情况下,右键单击 TextEdit .

  • 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

返回A String 在鼠标光标位置下显示单词的文本。

返回指定的 keyword 是否设置了颜色。

  • 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

返回 true 如果选择处于活动状态。

  • void menu_option ( int option )

通过指定的索引触发右键单击菜单操作。见 MenuItems 获取可用索引的列表。

  • void paste ( )

粘贴当前所选内容。

  • void redo ( )

执行重做操作。

  • void remove_breakpoints ( )

删除所有断点。这不会点燃 breakpoint_toggled 信号。

在文本中执行搜索。搜索标志可以在“search”枚举中指定。

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

如果 true ,隐藏指定索引的行。

  • void toggle_fold_line ( int line )

在给定行切换代码块的折叠。

  • void undo ( )

执行撤消操作。

  • void unfold_line ( int line )

如果折叠,则展开给定的行。

  • void unhide_all_lines ( )

取消隐藏以前设置为隐藏的所有行 set_line_as_hidden .