Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
TextEdit
繼承: Control < CanvasItem < Node < Object
被繼承: CodeEdit
多行文字編輯器。
說明
A multiline text editor. It also has limited facilities for editing code, such as syntax highlighting support. For more advanced facilities for editing code, see CodeEdit.
While entering text, it is possible to insert special characters using Unicode, OEM or Windows alt codes:
To enter Unicode codepoints, hold Alt and type the codepoint on the numpad. For example, to enter the character
á(U+00E1), hold Alt and type +E1 on the numpad (the leading zeroes can be omitted).To enter OEM codepoints, hold Alt and type the code on the numpad. For example, to enter the character
á(OEM 160), hold Alt and type160on the numpad.To enter Windows codepoints, hold Alt and type the code on the numpad. For example, to enter the character
á(Windows 0225), hold Alt and type 0, 2, 2, 5 on the numpad. The leading zero here must not be omitted, as this is how Windows codepoints are distinguished from OEM codepoints.
Note: Most viewport, caret, and edit methods contain a caret_index argument for caret_multiple support. The argument should be one of the following: -1 for all carets, 0 for the main caret, or greater than 0 for secondary carets in the order they were created.
Note: When holding down Alt, the vertical scroll wheel will scroll 5 times as fast as it would normally do. This also works in the Godot script editor.
屬性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
focus_mode |
|
|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
mouse_default_cursor_shape |
|
|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法
void |
_backspace(caret_index: int) virtual |
void |
|
void |
|
void |
_handle_unicode_input(unicode_char: int, caret_index: int) virtual |
void |
|
void |
_paste_primary_clipboard(caret_index: int) virtual |
void |
add_caret_at_carets(below: bool) |
void |
add_gutter(at: int = -1) |
void |
|
void |
adjust_carets_after_edit(caret: int, from_line: int, from_col: int, to_line: int, to_col: int) |
void |
adjust_viewport_to_caret(caret_index: int = 0) |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
center_viewport_to_caret(caret_index: int = 0) |
void |
clear() |
void |
|
void |
collapse_carets(from_line: int, from_column: int, to_line: int, to_column: int, inclusive: bool = false) |
void |
|
void |
|
void |
delete_selection(caret_index: int = -1) |
void |
|
void |
|
void |
|
void |
|
get_caret_column(caret_index: int = 0) const |
|
get_caret_count() const |
|
get_caret_draw_pos(caret_index: int = 0) const |
|
get_caret_line(caret_index: int = 0) const |
|
get_caret_wrap_index(caret_index: int = 0) const |
|
get_first_non_whitespace_column(line: int) const |
|
get_first_visible_line() const |
|
get_gutter_count() const |
|
get_gutter_name(gutter: int) const |
|
get_gutter_type(gutter: int) const |
|
get_gutter_width(gutter: int) const |
|
get_h_scroll_bar() const |
|
get_indent_level(line: int) const |
|
get_last_full_visible_line() const |
|
get_last_unhidden_line() const |
|
get_line_background_color(line: int) const |
|
get_line_column_at_pos(position: Vector2i, clamp_line: bool = true, clamp_column: bool = true) const |
|
get_line_count() const |
|
get_line_gutter_icon(line: int, gutter: int) const |
|
get_line_gutter_item_color(line: int, gutter: int) const |
|
get_line_gutter_metadata(line: int, gutter: int) const |
|
get_line_gutter_text(line: int, gutter: int) const |
|
get_line_height() const |
|
get_line_ranges_from_carets(only_selections: bool = false, merge_adjacent: bool = true) const |
|
get_line_width(line: int, wrap_index: int = -1) const |
|
get_line_with_ime(line: int) const |
|
get_line_wrap_count(line: int) const |
|
get_line_wrap_index_at_column(line: int, column: int) const |
|
get_line_wrapped_text(line: int) const |
|
get_local_mouse_pos() const |
|
get_menu() const |
|
get_minimap_line_at_pos(position: Vector2i) const |
|
get_minimap_visible_lines() const |
|
get_next_composite_character_column(line: int, column: int) const |
|
get_next_visible_line_index_offset_from(line: int, wrap_index: int, visible_amount: int) const |
|
get_next_visible_line_offset_from(line: int, visible_amount: int) const |
|
get_pos_at_line_column(line: int, column: int) const |
|
get_previous_composite_character_column(line: int, column: int) const |
|
get_rect_at_line_column(line: int, column: int) const |
|
get_saved_version() const |
|
get_scroll_pos_for_line(line: int, wrap_index: int = 0) const |
|
get_selected_text(caret_index: int = -1) |
|
get_selection_at_line_column(line: int, column: int, include_edges: bool = true, only_selections: bool = true) const |
|
get_selection_column(caret_index: int = 0) const |
|
get_selection_from_column(caret_index: int = 0) const |
|
get_selection_from_line(caret_index: int = 0) const |
|
get_selection_line(caret_index: int = 0) const |
|
get_selection_mode() const |
|
get_selection_origin_column(caret_index: int = 0) const |
|
get_selection_origin_line(caret_index: int = 0) const |
|
get_selection_to_column(caret_index: int = 0) const |
|
get_selection_to_line(caret_index: int = 0) const |
|
get_sorted_carets(include_ignored_carets: bool = false) const |
|
get_tab_size() const |
|
get_total_gutter_width() const |
|
get_total_visible_line_count() const |
|
get_v_scroll_bar() const |
|
get_version() const |
|
get_visible_line_count() const |
|
get_visible_line_count_in_range(from_line: int, to_line: int) const |
|
get_word_at_pos(position: Vector2) const |
|
get_word_under_caret(caret_index: int = -1) const |
|
has_ime_text() const |
|
has_redo() const |
|
has_selection(caret_index: int = -1) const |
|
has_undo() const |
|
void |
insert_line_at(line: int, text: String) |
void |
insert_text(text: String, line: int, column: int, before_selection_begin: bool = true, before_selection_end: bool = false) |
void |
insert_text_at_caret(text: String, caret_index: int = -1) |
is_caret_after_selection_origin(caret_index: int = 0) const |
|
is_caret_visible(caret_index: int = 0) const |
|
is_dragging_cursor() const |
|
is_gutter_clickable(gutter: int) const |
|
is_gutter_drawn(gutter: int) const |
|
is_gutter_overwritable(gutter: int) const |
|
is_in_mulitcaret_edit() const |
|
is_line_gutter_clickable(line: int, gutter: int) const |
|
is_line_in_viewport(line: int) const |
|
is_line_wrapped(line: int) const |
|
is_menu_visible() const |
|
is_mouse_over_selection(edges: bool, caret_index: int = -1) const |
|
is_overtype_mode_enabled() const |
|
void |
menu_option(option: int) |
void |
merge_gutters(from_line: int, to_line: int) |
void |
|
multicaret_edit_ignore_caret(caret_index: int) const |
|
void |
|
void |
paste_primary_clipboard(caret_index: int = -1) |
void |
redo() |
void |
remove_caret(caret: int) |
void |
remove_gutter(gutter: int) |
void |
remove_line_at(line: int, move_carets_down: bool = true) |
void |
|
void |
remove_text(from_line: int, from_column: int, to_line: int, to_column: int) |
search(text: String, flags: int, from_line: int, from_column: int) const |
|
void |
select(origin_line: int, origin_column: int, caret_line: int, caret_column: int, caret_index: int = 0) |
void |
|
void |
select_word_under_caret(caret_index: int = -1) |
void |
set_caret_column(column: int, adjust_viewport: bool = true, caret_index: int = 0) |
void |
set_caret_line(line: int, adjust_viewport: bool = true, can_be_hidden: bool = true, wrap_index: int = 0, caret_index: int = 0) |
void |
set_gutter_clickable(gutter: int, clickable: bool) |
void |
set_gutter_custom_draw(column: int, draw_callback: Callable) |
void |
set_gutter_draw(gutter: int, draw: bool) |
void |
set_gutter_name(gutter: int, name: String) |
void |
set_gutter_overwritable(gutter: int, overwritable: bool) |
void |
set_gutter_type(gutter: int, type: GutterType) |
void |
set_gutter_width(gutter: int, width: int) |
void |
|
void |
set_line_as_center_visible(line: int, wrap_index: int = 0) |
void |
set_line_as_first_visible(line: int, wrap_index: int = 0) |
void |
set_line_as_last_visible(line: int, wrap_index: int = 0) |
void |
set_line_background_color(line: int, color: Color) |
void |
set_line_gutter_clickable(line: int, gutter: int, clickable: bool) |
void |
set_line_gutter_icon(line: int, gutter: int, icon: Texture2D) |
void |
set_line_gutter_item_color(line: int, gutter: int, color: Color) |
void |
set_line_gutter_metadata(line: int, gutter: int, metadata: Variant) |
void |
set_line_gutter_text(line: int, gutter: int, text: String) |
void |
set_overtype_mode_enabled(enabled: bool) |
void |
set_search_flags(flags: int) |
void |
set_search_text(search_text: String) |
void |
set_selection_mode(mode: SelectionMode) |
void |
set_selection_origin_column(column: int, caret_index: int = 0) |
void |
set_selection_origin_line(line: int, can_be_hidden: bool = true, wrap_index: int = -1, caret_index: int = 0) |
void |
set_tab_size(size: int) |
void |
set_tooltip_request_func(callback: Callable) |
void |
|
void |
start_action(action: EditAction) |
void |
swap_lines(from_line: int, to_line: int) |
void |
|
void |
undo() |
主題屬性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
訊號
caret_changed() 🔗
Emitted when any caret changes position.
gutter_added() 🔗
新增邊欄時發出。
gutter_clicked(line: int, gutter: int) 🔗
點擊邊欄時發出。
gutter_removed() 🔗
移除邊欄時發出。
lines_edited_from(from_line: int, to_line: int) 🔗
文字改變時立即發出。
新增文字時 from_line 小於 to_line。移除文字時 to_line 小於 from_line。
text_changed() 🔗
當文字更改時觸發。
text_set() 🔗
列舉
剪切(複製並刪除)選中的文字。
複製選中的文字。
將剪貼板上的文字貼上在選定的文字上(或游標的位置)。
擦除整個 TextEdit 文字。
選擇整個 TextEdit 文字。
撤銷之前的操作。
重做前一個動作。
“文字書寫方向”子功能表的 ID。
將文字方向設定為繼承。
將文字方向設定為自動。
將文字方向設定為從左至右。
將文字方向設定為從右至左。
切換控制字元的顯示。
“插入控制字元”子功能表的 ID。
插入從左至右旗標(LRM)字元。
插入從右至左旗標(LRM)字元。
插入開始從左至右嵌入(LRE)字元。
插入開始從右至左嵌入(RLE)字元。
插入開始從左至右強制(LRO)字元。
插入開始從右至左嵌入(RLE)字元。
插入退出方向格式化(PDF)字元。
插入阿拉伯字母標記(ALM)字元。
插入從左至右隔離(LRI)字元。
插入從右至左隔離(RLI)字元。
插入第一個強隔離(FSI)字元。
插入退出方向隔離(PDI)字元。
插入零寬連接子(ZWJ)字元。
插入零寬非連接子(ZWNJ)字元。
插入文字連接子(WJ)字元。
插入軟連字號(SHY)字元。
Opens system emoji and symbol picker.
代表 MenuItems 列舉的大小。
enum EditAction: 🔗
EditAction ACTION_NONE = 0
無目前動作。
EditAction ACTION_TYPING = 1
打字動作。
EditAction ACTION_BACKSPACE = 2
向後刪除動作。
EditAction ACTION_DELETE = 3
向前刪除動作。
enum SearchFlags: 🔗
SearchFlags SEARCH_MATCH_CASE = 1
搜索時配對大小寫。
SearchFlags SEARCH_WHOLE_WORDS = 2
搜索時配對整個單詞。
SearchFlags SEARCH_BACKWARDS = 4
從頭到尾搜索。
enum CaretType: 🔗
CaretType CARET_TYPE_LINE = 0
垂直線游標。
CaretType CARET_TYPE_BLOCK = 1
方塊游標。
enum SelectionMode: 🔗
SelectionMode SELECTION_MODE_NONE = 0
不選擇。
SelectionMode SELECTION_MODE_SHIFT = 1
就像按下 shift 一樣進行選擇。
SelectionMode SELECTION_MODE_POINTER = 2
選擇單個字元,就像使用者按一下一樣。
SelectionMode SELECTION_MODE_WORD = 3
選擇整個單詞,就像使用者按兩下一樣。
SelectionMode SELECTION_MODE_LINE = 4
選擇整行文字,就像使用者三擊一樣。
enum LineWrappingMode: 🔗
LineWrappingMode LINE_WRAPPING_NONE = 0
換行被禁用。
LineWrappingMode LINE_WRAPPING_BOUNDARY = 1
換行發生在控制項邊界,超出通常可見的範圍。
enum GutterType: 🔗
GutterType GUTTER_TYPE_STRING = 0
When a gutter is set to string using set_gutter_type(), it is used to contain text set via the set_line_gutter_text() method.
GutterType GUTTER_TYPE_ICON = 1
When a gutter is set to icon using set_gutter_type(), it is used to contain an icon set via the set_line_gutter_icon() method.
GutterType GUTTER_TYPE_CUSTOM = 2
When a gutter is set to custom using set_gutter_type(), it is used to contain custom visuals controlled by a callback method set via the set_gutter_custom_draw() method.
屬性說明
AutowrapMode autowrap_mode = 3 🔗
void set_autowrap_mode(value: AutowrapMode)
AutowrapMode get_autowrap_mode()
If wrap_mode is set to LINE_WRAPPING_BOUNDARY, sets text wrapping mode.
bool backspace_deletes_composite_character_enabled = false 🔗
void set_backspace_deletes_composite_character_enabled(value: bool)
bool is_backspace_deletes_composite_character_enabled()
If true and caret_mid_grapheme is false, backspace deletes an entire composite character such as ❤️🩹, instead of deleting part of the composite character.
如果為 true,則文字游標會閃爍。
float caret_blink_interval = 0.65 🔗
文字游標的閃爍間隔(單位為秒)。
bool caret_draw_when_editable_disabled = false 🔗
void set_draw_caret_when_editable_disabled(value: bool)
bool is_drawing_caret_when_editable_disabled()
如果為 true,則禁用 editable 時游標可見。
bool caret_mid_grapheme = false 🔗
允許在單個複合字元的元件中進行移動游標、選中、刪除的操作。
注意:倒退鍵 Backspace 始終按複合字元的元件刪除。
bool caret_move_on_right_click = true 🔗
If true, a right-click moves the caret at the mouse position before displaying the context menu.
If false, the context menu ignores mouse location.
If true, multiple carets are allowed. Left-clicking with Alt adds a new caret. See add_caret() and get_caret_count().
設定要繪製的文字游標的型別。
為 true 時按右鍵會顯示本文功能表。
String custom_word_separators = "" 🔗
The characters to consider as word delimiters if use_custom_word_separators is true. The characters should be defined without separation, for example #_!.
bool deselect_on_focus_loss_enabled = true 🔗
如果為 true,則在丟失焦點時會取消選中文字。
bool drag_and_drop_selection_enabled = true 🔗
If true, allow drag and drop of selected text. Text can still be dropped from other sources.
bool draw_control_chars = false 🔗
如果為 true,則會顯示控制字元。
如果為 true,“空格”字元將具有可見表示形式。
如果為 true,“定位字元”字元將具有可見表示形式。
如果為 false,則不能修改現在的文字,也不能新增新文字。
If true, "Emoji and Symbols" menu is enabled.
bool empty_selection_clipboard_enabled = true 🔗
If true, copying or cutting without a selection is performed on all lines with a caret. Otherwise, copy and cut require a selection.
bool highlight_all_occurrences = false 🔗
如果為 true,所選文字的所有配對項都將突出顯示。
bool highlight_current_line = false 🔗
如果為 true,則包含游標的行會突出顯示。
bool indent_wrapped_lines = false 🔗
If true, all wrapped lines are indented to the same amount as the unwrapped line.
Language code used for line-breaking and text shaping algorithms. If left empty, the current locale is used instead.
bool middle_mouse_paste_enabled = true 🔗
如果為 false,將禁用滑鼠中鍵貼上剪貼板。
注意:這個方法只在 Linux 上實作。
If true, a minimap is shown, providing an outline of your source code. The minimap uses a fixed-width text size.
小地圖的寬度(以圖元為單位)。
String placeholder_text = "" 🔗
TextEdit 為空時顯示的文字。它不是 TextEdit 的預設值(參見 text)。
bool scroll_fit_content_height = false 🔗
If true, TextEdit fits its minimum height to the number of visible lines instead of scrolling vertically. If a maximum height is set (for example via Control.custom_maximum_size) and content exceeds it, a vertical scrollbar is shown.
bool scroll_fit_content_width = false 🔗
If true, TextEdit fits its minimum width to the widest line instead of scrolling horizontally. If a maximum width is set (for example via Control.custom_maximum_size) and content exceeds it, a horizontal scrollbar is shown.
如果有一個水平捲軸,這決定了目前的水平滾動值,單位是圖元。
bool scroll_past_end_of_file = false 🔗
允許滾動過最後一行,進入“虛擬”空間。
Scroll smoothly over the text rather than jumping to the next location.
float scroll_v_scroll_speed = 80.0 🔗
設定使用小地圖或當 scroll_smooth 被啟用時的滾動速度。
如果有一個垂直捲動條,這就決定了目前的垂直捲動值,以行數為單位,頂行從0開始。
bool selecting_enabled = true 🔗
如果為 true,文字可以被選擇。
如果為 false,使用者或使用select()或select_all()方法都不能選擇文字。
bool shortcut_keys_enabled = true 🔗
為 true 時,即使本文選單已被禁用,也會啟用該本文選單的快捷鍵。
StructuredTextParser structured_text_bidi_override = 0 🔗
void set_structured_text_bidi_override(value: StructuredTextParser)
StructuredTextParser get_structured_text_bidi_override()
為結構化文字設定 BiDi 演算法覆蓋。
Array structured_text_bidi_override_options = [] 🔗
void set_structured_text_bidi_override_options(value: Array)
Array get_structured_text_bidi_override_options()
設定 BiDi 覆蓋的附加選項。
SyntaxHighlighter syntax_highlighter 🔗
void set_syntax_highlighter(value: SyntaxHighlighter)
SyntaxHighlighter get_syntax_highlighter()
The syntax highlighter to use.
Note: A SyntaxHighlighter instance should not be used across multiple TextEdit nodes.
If true, ProjectSettings.input/ui_text_indent input Tab character, otherwise it moves keyboard focus to the next Control in the scene.
TextEdit 的字串值。
TextDirection text_direction = 0 🔗
void set_text_direction(value: TextDirection)
TextDirection get_text_direction()
基礎文字書寫方向。
bool use_custom_word_separators = false 🔗
If false, using Ctrl + Left or Ctrl + Right (Cmd + Left or Cmd + Right on macOS) bindings will use the behavior of use_default_word_separators. If true, it will also stop the caret if a character within custom_word_separators is detected. Useful for subword moving. This behavior also will be applied to the behavior of text selection.
bool use_default_word_separators = true 🔗
If false, using Ctrl + Left or Ctrl + Right (Cmd + Left or Cmd + Right on macOS) bindings will stop moving caret only if a space or punctuation is detected. If true, it will also stop the caret if a character is part of !"#$%&'()*+,-./:;<=>?@[\]^`{|}~, the Unicode General Punctuation table, or the Unicode CJK Punctuation table. Useful for subword moving. This behavior also will be applied to the behavior of text selection.
bool virtual_keyboard_enabled = true 🔗
If true, the native virtual keyboard is enabled on platforms that support it.
bool virtual_keyboard_show_on_focus = true 🔗
If true, the native virtual keyboard is shown on focus events on platforms that support it.
LineWrappingMode wrap_mode = 0 🔗
void set_line_wrapping_mode(value: LineWrappingMode)
LineWrappingMode get_line_wrapping_mode()
設定要使用的換行模式。
方法說明
void _backspace(caret_index: int) virtual 🔗
覆蓋此方法可以定義使用者按下倒退鍵時應該發生什麼。
void _copy(caret_index: int) virtual 🔗
覆蓋此方法可以定義使用者執行複製操作時應該發生什麼。
void _cut(caret_index: int) virtual 🔗
覆蓋此方法可以定義使用者執行剪切操作時應該發生什麼。
void _handle_unicode_input(unicode_char: int, caret_index: int) virtual 🔗
覆蓋此方法可以定義使用者打出所提供的鍵 unicode_char 時應該發生什麼。
void _paste(caret_index: int) virtual 🔗
覆蓋此方法可以定義使用者執行貼上操作時應該發生什麼。
void _paste_primary_clipboard(caret_index: int) virtual 🔗
覆蓋此方法可以定義使用者使用滑鼠中鍵執行貼上操作時應該發生什麼。
注意:此方法僅在 Linux 上實作。
int add_caret(line: int, column: int) 🔗
在給定的位置新增新的游標。返回新游標的索引,如果位置無效則返回 -1。
void add_caret_at_carets(below: bool) 🔗
Adds an additional caret above or below every caret. If below is true the new caret will be added below and above otherwise.
void add_gutter(at: int = -1) 🔗
為這個 TextEdit 註冊一個新的邊欄。請使用 at 指定邊欄的順序。-1 會將該邊欄追加到右側。
void add_selection_for_next_occurrence() 🔗
選中目前所選內容下一次出現的位置並新增文字游標。如果沒有活動的選中內容,則選中目前游標所處的單詞。
void adjust_carets_after_edit(caret: int, from_line: int, from_col: int, to_line: int, to_col: int) 🔗
已棄用: No longer necessary since methods now adjust carets themselves.
This method does nothing.
void adjust_viewport_to_caret(caret_index: int = 0) 🔗
調整視口,讓游標可見。
void apply_ime() 🔗
Applies text from the Input Method Editor (IME) to each caret and closes the IME if it is open.
void backspace(caret_index: int = -1) 🔗
使用者按下倒退鍵時呼叫。可以用 _backspace() 覆蓋。
void begin_complex_operation() 🔗
開始一個多部分編輯。在呼叫 end_complex_operation() 之前,所有編輯都將被視為一個動作。
void begin_multicaret_edit() 🔗
Starts an edit for multiple carets. The edit must be ended with end_multicaret_edit(). Multicaret edits can be used to edit text at multiple carets and delay merging the carets until the end, so the caret indexes aren't affected immediately. begin_multicaret_edit() and end_multicaret_edit() can be nested, and the merge will happen at the last end_multicaret_edit().
begin_complex_operation()
begin_multicaret_edit()
for i in range(get_caret_count()):
if multicaret_edit_ignore_caret(i):
continue
# Logic here.
end_multicaret_edit()
end_complex_operation()
void cancel_ime() 🔗
Closes the Input Method Editor (IME) if it is open. Any text in the IME will be lost.
void center_viewport_to_caret(caret_index: int = 0) 🔗
將視口居中在正在編輯的插入符號所在的行上。這也將 scroll_horizontal 值重設為 0。
void clear() 🔗
執行對 TextEdit 的完全重設,包括撤銷歷史。
void clear_undo_history() 🔗
清除撤銷歷史。
void collapse_carets(from_line: int, from_column: int, to_line: int, to_column: int, inclusive: bool = false) 🔗
Collapse all carets in the given range to the from_line and from_column position.
inclusive applies to both ends.
If is_in_mulitcaret_edit() is true, carets that are collapsed will be true for multicaret_edit_ignore_caret().
merge_overlapping_carets() will be called if any carets were collapsed.
void copy(caret_index: int = -1) 🔗
複製目前選區。可以使用 _copy() 覆蓋。
void cut(caret_index: int = -1) 🔗
剪切目前選區。可以使用 _cut() 覆蓋。
void delete_selection(caret_index: int = -1) 🔗
刪除選定的文字。
void deselect(caret_index: int = -1) 🔗
取消目前選擇。
void end_action() 🔗
標記在 start_action() 開始的目前動作中步驟的末尾。
void end_complex_operation() 🔗
結束一個多部分編輯,該多部分編輯從 begin_complex_operation() 開始。如果在一個複雜動作之外呼叫,則將目前動作將被壓入撤銷/重做堆疊。
void end_multicaret_edit() 🔗
Ends an edit for multiple carets, that was started with begin_multicaret_edit(). If this was the last end_multicaret_edit() and merge_overlapping_carets() was called, carets will be merged.
int get_caret_column(caret_index: int = 0) const 🔗
返回編輯游標所在的列。
返回該 TextEdit 中的游標數。
Vector2 get_caret_draw_pos(caret_index: int = 0) const 🔗
返回游標的圖元繪製位置。
PackedInt32Array get_caret_index_edit_order() 🔗
已棄用: Carets no longer need to be edited in any specific order. If the carets need to be sorted, use get_sorted_carets() instead.
返回文字游標索引的列表,使用編輯順序,從下到上進行。編輯順序是 insert_text_at_caret() 等動作的套用順序。
int get_caret_line(caret_index: int = 0) const 🔗
返回編輯游標所在的行。
int get_caret_wrap_index(caret_index: int = 0) const 🔗
返回正編輯的文字游標所在的換行索引。
int get_first_non_whitespace_column(line: int) const 🔗
Returns the first column containing a non-whitespace character on the given line. If there is only whitespace, returns the number of characters.
int get_first_visible_line() const 🔗
返回第一個可見行。
int get_gutter_count() const 🔗
返回註冊的邊欄數量。
String get_gutter_name(gutter: int) const 🔗
返回給定索引處邊欄的名稱。
GutterType get_gutter_type(gutter: int) const 🔗
Returns the type of the gutter at the given index. Gutters can contain icons, text, or custom visuals.
int get_gutter_width(gutter: int) const 🔗
返回給定索引處邊欄的寬度。
HScrollBar get_h_scroll_bar() const 🔗
設定該 TextEdit 所使用的 HScrollBar。
int get_indent_level(line: int) const 🔗
Returns the indent level of the given line. This is the number of spaces and tabs at the beginning of the line, with the tabs taking the tab size into account (see get_tab_size()).
int get_last_full_visible_line() const 🔗
返回最後一個可見的行。獲得換行索引的話,使用 get_last_full_visible_line_wrap_index()。
int get_last_full_visible_line_wrap_index() const 🔗
返回最後一個可見行的最後一個可見換行索引。
返回整個 TextEdit 中最後一個未隱藏的行。
String get_line(line: int) const 🔗
返回特定行的文字。
Color get_line_background_color(line: int) const 🔗
Returns the custom background color of the given line. If no color is set, returns Color(0, 0, 0, 0).
Vector2i get_line_column_at_pos(position: Vector2i, clamp_line: bool = true, clamp_column: bool = true) const 🔗
Returns the line and column at the given position. In the returned vector, x is the column and y is the line.
If clamp_line is false and position is below the last line, Vector2i(-1, -1) is returned.
If clamp_column is false and position is outside the column range of the line, Vector2i(-1, -1) is returned.
返回文字中的行數。
Texture2D get_line_gutter_icon(line: int, gutter: int) const 🔗
Returns the icon currently in gutter at line. This only works when the gutter type is GUTTER_TYPE_ICON (see set_gutter_type()).
Color get_line_gutter_item_color(line: int, gutter: int) const 🔗
返回邊欄 gutter 中,目前位於 line 行的顏色。
Variant get_line_gutter_metadata(line: int, gutter: int) const 🔗
返回邊欄 gutter 中,目前位於 line 行的中繼資料。
String get_line_gutter_text(line: int, gutter: int) const 🔗
Returns the text currently in gutter at line. This only works when the gutter type is GUTTER_TYPE_STRING (see set_gutter_type()).
返回所有行中行高的最大值。
注意:返回值受 line_spacing 和 font_size 的影響。不會比 1 小。
Array[Vector2i] get_line_ranges_from_carets(only_selections: bool = false, merge_adjacent: bool = true) const 🔗
Returns an Array of line ranges where x is the first line and y is the last line. All lines within these ranges will have a caret on them or be part of a selection. Each line will only be part of one line range, even if it has multiple carets on it.
If a selection's end column (get_selection_to_column()) is at column 0, that line will not be included. If a selection begins on the line after another selection ends and merge_adjacent is true, or they begin and end on the same line, one line range will include both selections.
int get_line_width(line: int, wrap_index: int = -1) const 🔗
返回位於 line 的 wrap_index 的圖元寬度。
String get_line_with_ime(line: int) const 🔗
Returns line text as it is currently displayed, including IME composition string.
int get_line_wrap_count(line: int) const 🔗
返回給定行換行的次數。
int get_line_wrap_index_at_column(line: int, column: int) const 🔗
Returns the wrap index of the given column on the given line. This ranges from 0 to get_line_wrap_count().
PackedStringArray get_line_wrapped_text(line: int) const 🔗
返回代表各個換行索引的 String 陣列。
Vector2 get_local_mouse_pos() const 🔗
返回針對文字方向調整過的局部滑鼠位置。
返回該 TextEdit 的 PopupMenu。預設情況下,會在按右鍵 TextEdit 時顯示改選單。
你可以新增自訂功能表專案,也可以移除標準功能表專案。請確保你使用的 ID 與標準功能表專案的 ID 不衝突(見 MenuItems)。例如:
func _ready():
var menu = get_menu()
# 移除“撤銷”後的所有功能表專案。
menu.item_count = menu.get_item_index(MENU_REDO) + 1
# 新增自訂功能表專案。
menu.add_separator()
menu.add_item("插入日期", MENU_MAX + 1)
# 連接回呼函式。
menu.id_pressed.connect(_on_item_pressed)
func _on_item_pressed(id):
if id == MENU_MAX + 1:
insert_text_at_caret(Time.get_date_string_from_system())
public override void _Ready()
{
var menu = GetMenu();
// 移除“撤銷”後的所有功能表專案。
menu.ItemCount = menu.GetItemIndex(TextEdit.MenuItems.Redo) + 1;
// 新增自訂功能表專案。
menu.AddSeparator();
menu.AddItem("插入日期", TextEdit.MenuItems.Max + 1);
// 新增事件處理器。
menu.IdPressed += OnItemPressed;
}
public void OnItemPressed(int id)
{
if (id == TextEdit.MenuItems.Max + 1)
{
InsertTextAtCaret(Time.GetDateStringFromSystem());
}
}
警告:這是必要的內部節點,將其移除或釋放會導致當機。如果你想要將其隱藏,或者將其子節點隱藏,請使用對應的 Window.visible 屬性。
int get_minimap_line_at_pos(position: Vector2i) const 🔗
返回小地圖 position 處等價的行。
int get_minimap_visible_lines() const 🔗
返回小地圖上能夠繪製的行數。
int get_next_composite_character_column(line: int, column: int) const 🔗
Returns the correct column at the end of a composite character like ❤️🩹 (mending heart; Unicode: U+2764 U+FE0F U+200D U+1FA79) which is comprised of more than one Unicode code point, if the caret is at the start of the composite character. Also returns the correct column with the caret at mid grapheme and for non-composite characters.
Note: To check at caret location use get_next_composite_character_column(get_caret_line(), get_caret_column())
Vector2i get_next_visible_line_index_offset_from(line: int, wrap_index: int, visible_amount: int) const 🔗
類似於 get_next_visible_line_offset_from(),但考慮了換行索引。在返回的向量中,x 是行,y 是換行索引。
int get_next_visible_line_offset_from(line: int, visible_amount: int) const 🔗
返回從 line 到 line + visible_amount 的下一個可見行的計數。也可以倒數計數。例如,如果 TextEdit 有 5 行,其中隱藏了第 2 行和第 3 行,使用 line = 1, visible_amount = 1 呼叫它會返回 3。
Vector2i get_pos_at_line_column(line: int, column: int) const 🔗
返回給定 line 和 column 的局部位置。如果返回的向量的 x 或 y 等於 -1,則該位置在該控制項的可視區域之外。
注意:Y 位置對應於行的底部。請使用 get_rect_at_line_column() 來獲取頂部位置。
int get_previous_composite_character_column(line: int, column: int) const 🔗
Returns the correct column at the start of a composite character like ❤️🩹 (mending heart; Unicode: U+2764 U+FE0F U+200D U+1FA79) which is comprised of more than one Unicode code point, if the caret is at the end of the composite character. Also returns the correct column with the caret at mid grapheme and for non-composite characters.
Note: To check at caret location use get_previous_composite_character_column(get_caret_line(), get_caret_column())
Rect2i get_rect_at_line_column(line: int, column: int) const 🔗
返回給定 line 和 column 處的字素的局部位置和大小。如果返回的矩形的 x 或 y 位置等於 -1,則該位置在該控制項的可視區域之外。
注意:返回的矩形的 Y 位置對應於該行的頂部,不像 get_pos_at_line_column() 返回底邊。
int get_saved_version() const 🔗
從 tag_saved_version() 返回最後一個標記的保存版本。
float get_scroll_pos_for_line(line: int, wrap_index: int = 0) const 🔗
返回 line 的 wrap_index 對應的滾動位置。
String get_selected_text(caret_index: int = -1) 🔗
返回游標所選文字,如果 caret_index 為預設值 -1 則為所有游標所選文字。
int get_selection_at_line_column(line: int, column: int, include_edges: bool = true, only_selections: bool = true) const 🔗
Returns the caret index of the selection at the given line and column, or -1 if there is none.
If include_edges is false, the position must be inside the selection and not at either end. If only_selections is false, carets without a selection will also be considered.
int get_selection_column(caret_index: int = 0) const 🔗
已棄用: Use get_selection_origin_column() instead.
返回選區的原始起始列。
int get_selection_from_column(caret_index: int = 0) const 🔗
Returns the selection begin column. Returns the caret column if there is no selection.
int get_selection_from_line(caret_index: int = 0) const 🔗
Returns the selection begin line. Returns the caret line if there is no selection.
int get_selection_line(caret_index: int = 0) const 🔗
已棄用: Use get_selection_origin_line() instead.
返回選區的原始起始行。
SelectionMode get_selection_mode() const 🔗
返回目前的選區模式。
int get_selection_origin_column(caret_index: int = 0) const 🔗
Returns the origin column of the selection. This is the opposite end from the caret.
int get_selection_origin_line(caret_index: int = 0) const 🔗
Returns the origin line of the selection. This is the opposite end from the caret.
int get_selection_to_column(caret_index: int = 0) const 🔗
Returns the selection end column. Returns the caret column if there is no selection.
int get_selection_to_line(caret_index: int = 0) const 🔗
Returns the selection end line. Returns the caret line if there is no selection.
PackedInt32Array get_sorted_carets(include_ignored_carets: bool = false) const 🔗
Returns the carets sorted by selection beginning from lowest line and column to highest (from top to bottom of text).
If include_ignored_carets is false, carets from multicaret_edit_ignore_caret() will be ignored.
返回該 TextEdit 的定位字元大小。
int get_total_gutter_width() const 🔗
返回所有欄位及內部邊距的總寬度。
int get_total_visible_line_count() const 🔗
Returns the total number of lines in the text. This includes wrapped lines and excludes folded lines. If wrap_mode is set to LINE_WRAPPING_NONE and no lines are folded (see CodeEdit.is_line_folded()) then this is equivalent to get_line_count(). See get_visible_line_count_in_range() for a limited range of lines.
VScrollBar get_v_scroll_bar() const 🔗
設定該 TextEdit 所使用的 StyleBox。
返回該 TextEdit 的目前版本。版本是撤銷/重做歷史所記錄操作的計數。
int get_visible_line_count() const 🔗
Returns the number of lines that can visually fit, rounded down, based on this control's height.
int get_visible_line_count_in_range(from_line: int, to_line: int) const 🔗
Returns the total number of lines between from_line and to_line (inclusive) in the text. This includes wrapped lines and excludes folded lines. If the range covers all lines it is equivalent to get_total_visible_line_count().
String get_word_at_pos(position: Vector2) const 🔗
返回位於 position 的單詞。
String get_word_under_caret(caret_index: int = -1) const 🔗
返回一個 String 文字,其中包含文字游標位置下的單詞。
Returns true if the user has text in the Input Method Editor (IME).
有“重做”動作可用時返回 true。
bool has_selection(caret_index: int = -1) const 🔗
如果使用者選中了文字,則返回 true。
有“撤銷”動作可用時返回 true。
void insert_line_at(line: int, text: String) 🔗
在第 line 行插入文字為 text 的新行。
void insert_text(text: String, line: int, column: int, before_selection_begin: bool = true, before_selection_end: bool = false) 🔗
Inserts the text at line and column.
If before_selection_begin is true, carets and selections that begin at line and column will moved to the end of the inserted text, along with all carets after it.
If before_selection_end is true, selections that end at line and column will be extended to the end of the inserted text. These parameters can be used to insert text inside of or outside of selections.
void insert_text_at_caret(text: String, caret_index: int = -1) 🔗
在游標位置插入指定的文字。
bool is_caret_after_selection_origin(caret_index: int = 0) const 🔗
Returns true if the caret of the selection is after the selection origin. This can be used to determine the direction of the selection.
bool is_caret_visible(caret_index: int = 0) const 🔗
Returns true if the caret is visible, false otherwise. A caret will be considered hidden if it is outside the scrollable area when scrolling is enabled.
Note: is_caret_visible() does not account for a caret being off-screen if it is still within the scrollable area. It will return true even if the caret is off-screen as long as it meets TextEdit's own conditions for being visible. This includes uses of scroll_fit_content_width and scroll_fit_content_height that cause the TextEdit to expand beyond the viewport's bounds.
Note: This method does not guarantee an accurate visibility check immediately after setting the caret position. The correct value may only be available in the next frame after the TextEdit has finished drawing. This also applies to any operation that causes the TextEdit to change in size.
bool is_dragging_cursor() const 🔗
Returns true if the user is dragging their mouse for scrolling, selecting, or text dragging.
bool is_gutter_clickable(gutter: int) const 🔗
Returns true if the gutter at the given index is clickable. See set_gutter_clickable().
bool is_gutter_drawn(gutter: int) const 🔗
Returns true if the gutter at the given index is currently drawn. See set_gutter_draw().
bool is_gutter_overwritable(gutter: int) const 🔗
Returns true if the gutter at the given index is overwritable. See set_gutter_overwritable().
bool is_in_mulitcaret_edit() const 🔗
Returns true if a begin_multicaret_edit() has been called and end_multicaret_edit() has not yet been called.
bool is_line_gutter_clickable(line: int, gutter: int) const 🔗
Returns true if the gutter at the given index on the given line is clickable. See set_line_gutter_clickable().
bool is_line_in_viewport(line: int) const 🔗
Returns true if the given line is within the scope of the scrollable area of the viewport.
bool is_line_wrapped(line: int) const 🔗
返回給定的行是否換行。
Returns true if the menu is visible. Use this instead of get_menu().visible to improve performance (so the creation of the menu is avoided). See get_menu().
bool is_mouse_over_selection(edges: bool, caret_index: int = -1) const 🔗
Returns true if the mouse is over a selection. If edges is true, the edges are considered part of the selection.
bool is_overtype_mode_enabled() const 🔗
Returns true if overtype mode is enabled. See set_overtype_mode_enabled().
執行 MenuItems 列舉中定義的給定操作。
void merge_gutters(from_line: int, to_line: int) 🔗
Merge the gutters from from_line into to_line. Only overwritable gutters will be copied. See set_gutter_overwritable().
void merge_overlapping_carets() 🔗
Merges any overlapping carets. Will favor the newest caret, or the caret with a selection.
If is_in_mulitcaret_edit() is true, the merge will be queued to happen at the end of the multicaret edit. See begin_multicaret_edit() and end_multicaret_edit().
Note: This is not called when a caret changes position but after certain actions, so it is possible to get into a state where carets overlap.
bool multicaret_edit_ignore_caret(caret_index: int) const 🔗
Returns true if the given caret_index should be ignored as part of a multicaret edit. See begin_multicaret_edit() and end_multicaret_edit(). Carets that should be ignored are ones that were part of removed text and will likely be merged at the end of the edit, or carets that were added during the edit.
It is recommended to continue within a loop iterating on multiple carets if a caret should be ignored.
void paste(caret_index: int = -1) 🔗
貼上到目前位置。可以用 _paste() 覆蓋。
void paste_primary_clipboard(caret_index: int = -1) 🔗
貼上主剪貼板。
void redo() 🔗
執行重做操作。
void remove_caret(caret: int) 🔗
移除給定的文字游標索引。
注意:可能導致所有其他游標索引的調整。
void remove_gutter(gutter: int) 🔗
Removes the gutter at the given index.
void remove_line_at(line: int, move_carets_down: bool = true) 🔗
Removes the line of text at line. Carets on this line will attempt to match their previous visual x position.
If move_carets_down is true carets will move to the next line down, otherwise carets will move up.
void remove_secondary_carets() 🔗
移除所有額外的游標。
void remove_text(from_line: int, from_column: int, to_line: int, to_column: int) 🔗
Removes text between the given positions.
Vector2i search(text: String, flags: int, from_line: int, from_column: int) const 🔗
在文字內部進行搜索。搜索旗標可以在 SearchFlags 列舉中指定。
在返回的向量中,x 是列,y 是行。如果沒有找到結果,則兩者都等於 -1 。
var result = search("print", SEARCH_WHOLE_WORDS, 0, 0)
if result.x != -1:
# 找到了結果。
var line_number = result.y
var column_number = result.x
Vector2I result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0);
if (result.X != -1)
{
// 找到了結果。
int lineNumber = result.Y;
int columnNumber = result.X;
}
void select(origin_line: int, origin_column: int, caret_line: int, caret_column: int, caret_index: int = 0) 🔗
Selects text from origin_line and origin_column to caret_line and caret_column for the given caret_index. This moves the selection origin and the caret. If the positions are the same, the selection will be deselected.
If selecting_enabled is false, no selection will occur.
Note: If supporting multiple carets this will not check for any overlap. See merge_overlapping_carets().
void select_all() 🔗
選擇所有文字。
如果 selecting_enabled 為 false,則不會發生選擇。
void select_word_under_caret(caret_index: int = -1) 🔗
選中游標下的單詞。
void set_caret_column(column: int, adjust_viewport: bool = true, caret_index: int = 0) 🔗
將游標移動到指定的 column 索引。
如果 adjust_viewport 為 true,則視口將在移動發生後以游標位置為中心。
注意:如果支援多個游標,則不會檢查任何重疊。請參閱 merge_overlapping_carets()。
void set_caret_line(line: int, adjust_viewport: bool = true, can_be_hidden: bool = true, wrap_index: int = 0, caret_index: int = 0) 🔗
Moves the caret to the specified line index. The caret column will be moved to the same visual position it was at the last time set_caret_column() was called, or clamped to the end of the line.
If adjust_viewport is true, the viewport will center at the caret position after the move occurs.
If can_be_hidden is true, the specified line can be hidden.
If wrap_index is -1, the caret column will be clamped to the line's length. If wrap_index is greater than -1, the column will be moved to attempt to match the visual x position on the line's wrap_index to the position from the last time set_caret_column() was called.
Note: If supporting multiple carets this will not check for any overlap. See merge_overlapping_carets().
void set_gutter_clickable(gutter: int, clickable: bool) 🔗
If true, the mouse cursor will change to a pointing hand (Control.CURSOR_POINTING_HAND) when hovering over the gutter at the given index. See is_gutter_clickable() and set_line_gutter_clickable().
void set_gutter_custom_draw(column: int, draw_callback: Callable) 🔗
Set a custom draw callback for the gutter at the given index. draw_callback must take the following arguments: A line index int, a gutter index int, and an area Rect2. This callback only works when the gutter type is GUTTER_TYPE_CUSTOM (see set_gutter_type()).
void set_gutter_draw(gutter: int, draw: bool) 🔗
If true, the gutter at the given index is drawn. The gutter type (set_gutter_type()) determines how it is drawn. See is_gutter_drawn().
void set_gutter_name(gutter: int, name: String) 🔗
Sets the name of the gutter at the given index.
void set_gutter_overwritable(gutter: int, overwritable: bool) 🔗
If true, the line data of the gutter at the given index can be overridden when using merge_gutters(). See is_gutter_overwritable().
void set_gutter_type(gutter: int, type: GutterType) 🔗
Sets the type of gutter at the given index. Gutters can contain icons, text, or custom visuals.
void set_gutter_width(gutter: int, width: int) 🔗
Set the width of the gutter at the given index.
void set_line(line: int, new_text: String) 🔗
Sets the text for a specific line.
Carets on the line will attempt to keep their visual x position.
void set_line_as_center_visible(line: int, wrap_index: int = 0) 🔗
將 line 的 wrap_index 放置在視口的中心。
void set_line_as_first_visible(line: int, wrap_index: int = 0) 🔗
將 line 的 wrap_index 放置在視口的頂部。
void set_line_as_last_visible(line: int, wrap_index: int = 0) 🔗
將 line 的 wrap_index 放置在視口的底部。
void set_line_background_color(line: int, color: Color) 🔗
Sets the custom background color of the given line. If transparent, this color is applied on top of the default background color (See background_color). If set to Color(0, 0, 0, 0), no additional color is applied.
void set_line_gutter_clickable(line: int, gutter: int, clickable: bool) 🔗
If clickable is true, makes the gutter on the given line clickable. This is like set_gutter_clickable(), but for a single line. If is_gutter_clickable() is true, this will not have any effect. See is_line_gutter_clickable() and gutter_clicked.
void set_line_gutter_icon(line: int, gutter: int, icon: Texture2D) 🔗
Sets the icon for gutter on line to icon. This only works when the gutter type is GUTTER_TYPE_ICON (see set_gutter_type()).
void set_line_gutter_item_color(line: int, gutter: int, color: Color) 🔗
將邊欄 gutter 在第 line 行的顏色設定為 color。
void set_line_gutter_metadata(line: int, gutter: int, metadata: Variant) 🔗
將邊欄 gutter 在第 line 行的中繼資料設定為 metadata。
void set_line_gutter_text(line: int, gutter: int, text: String) 🔗
Sets the text for gutter on line to text. This only works when the gutter type is GUTTER_TYPE_STRING (see set_gutter_type()).
void set_overtype_mode_enabled(enabled: bool) 🔗
If true, enables overtype mode. In this mode, typing overrides existing text instead of inserting text. The ProjectSettings.input/ui_text_toggle_insert_mode action toggles overtype mode. See is_overtype_mode_enabled().
void set_search_flags(flags: int) 🔗
設定搜索旗標 flags。配合 set_search_text() 使用可以高亮被搜索的文字。搜索旗標可以使用 SearchFlags 列舉指定。
void set_search_text(search_text: String) 🔗
設定搜索文字。見 set_search_flags()。
void set_selection_mode(mode: SelectionMode) 🔗
設定目前的選區模式。
void set_selection_origin_column(column: int, caret_index: int = 0) 🔗
Sets the selection origin column to the column for the given caret_index. If the selection origin is moved to the caret position, the selection will deselect.
void set_selection_origin_line(line: int, can_be_hidden: bool = true, wrap_index: int = -1, caret_index: int = 0) 🔗
Sets the selection origin line to the line for the given caret_index. If the selection origin is moved to the caret position, the selection will deselect.
If can_be_hidden is false, The line will be set to the nearest unhidden line below or above.
If wrap_index is -1, the selection origin column will be clamped to the line's length. If wrap_index is greater than -1, the column will be moved to attempt to match the visual x position on the line's wrap_index to the position from the last time set_selection_origin_column() or select() was called.
void set_tab_size(size: int) 🔗
設定該 TextEdit 使用的定位字元大小。
void set_tooltip_request_func(callback: Callable) 🔗
提供自訂工具提示文字。該回呼函式方法必須接受以下參數:hovered_word: String。
void skip_selection_for_next_occurrence() 🔗
Moves a selection and a caret for the next occurrence of the current selection. If there is no active selection, moves to the next occurrence of the word under caret.
void start_action(action: EditAction) 🔗
開始一個動作,如果 action 與目前動作不同,則會終止目前動作。
呼叫 end_action()、觸發 ProjectSettings.gui/timers/text_edit_idle_detect_sec 或者在 start_action() 和 end_action() 之外呼叫可撤銷的操作都會導致動作的終止。
void swap_lines(from_line: int, to_line: int) 🔗
Swaps the two lines. Carets will be swapped with the lines.
void tag_saved_version() 🔗
將目前版本標記為已保存。
void undo() 🔗
執行撤銷操作。
主題屬性說明
Color background_color = Color(0, 0, 0, 0) 🔗
設定該 TextEdit 的背景 Color。
Color caret_background_color = Color(0, 0, 0, 1) 🔗
使用區塊游標時,游標下文字的 Color。
Color caret_color = Color(0.875, 0.875, 0.875, 1) 🔗
游標的 Color。可以設為完全透明的顏色,從而完全隱藏游標。
Color current_line_color = Color(0.25, 0.25, 0.26, 0.8) 🔗
游標所在行的背景 Color。
Color font_color = Color(0.875, 0.875, 0.875, 1) 🔗
設定字形顏色 Color。
Color font_outline_color = Color(0, 0, 0, 1) 🔗
該 TextEdit 的文字輪廓的色調。
Color font_placeholder_color = Color(0.875, 0.875, 0.875, 0.6) 🔗
placeholder_text 的字形顏色。
Color font_readonly_color = Color(0.875, 0.875, 0.875, 0.5) 🔗
Color font_selected_color = Color(0, 0, 0, 0) 🔗
設定所選文字的 Color。如果等於 Color(0, 0, 0, 0),則該屬性將被忽略。
Color search_result_border_color = Color(0.3, 0.3, 0.3, 0.4) 🔗
與搜索查詢配對的文字周圍的邊框的 Color。
Color search_result_color = Color(0.3, 0.3, 0.3, 1) 🔗
與搜索查詢配對的文字背景的 Color。
Color selection_color = Color(0.5, 0.5, 0.5, 1) 🔗
設定文字選擇的高亮 Color 顏色。
Color word_highlighted_color = Color(0.5, 0.5, 0.5, 0.25) 🔗
設定多次出現的高亮 Color 顏色。須啟用 highlight_all_occurrences 。
文字游標的圖元寬度。較大的值能夠確保游標易於看到,確保游標與較大的字形保持一致,從而提高可存取性。如果設定為 0 或更低,游標的寬度將被自動設置為 1 圖元,並乘以顯示縮放係數。
Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.
文字輪廓的大小。
注意:如果使用啟用了 FontFile.multichannel_signed_distance_field 的字形,其 FontFile.msdf_pixel_range 必須至少設定為 outline_size 的兩倍,輪廓算繪才能看起來正確。否則,輪廓可能會比預期的更早被切斷。
Sets an additional margin for line wrapping width.
設定預設的字形 Font。
設定預設的字形大小。
為空格文字字元,設定一個自訂 Texture2D。
為定位字元文字字元,設定一個自訂 Texture2D。
Sets the StyleBox when in focus. The focus StyleBox is displayed over the base StyleBox, so a partially transparent StyleBox should be used to ensure the base StyleBox remains visible. A StyleBox that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a StyleBoxEmpty resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
設定這個 TextEdit 的 StyleBox。