From 5f8f4842bb08227f31cecc50cfac86d504703205 Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Wed, 8 Jun 2022 23:10:34 +0100 Subject: Update TextEdit docs --- doc/classes/TextEdit.xml | 128 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 127 insertions(+), 1 deletion(-) (limited to 'doc/classes') diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index 0905c0c20b..2f9b971fc8 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -5,6 +5,7 @@ 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. + [b]Note:[/b] Most viewport, caret and edit methods contain a [code]caret_index[/code] argument for [member caret_multiple] support. The argument should be one of the following: [code]-1[/code] for all carets, [code]0[/code] for the main caret, or greater than [code]0[/code] for secondary carets. [b]Note:[/b] When holding down [kbd]Alt[/kbd], the vertical scroll wheel will scroll 5 times as fast as it would normally do. This also works in the Godot script editor. @@ -12,18 +13,21 @@ + Override this method to define what happens when the user presses the backspace key. + Override this method to define what happens when the user performs a copy operation. + Override this method to define what happens when the user performs a cut operation. @@ -31,23 +35,34 @@ + Override this method to define what happens when the user types in the provided key [param unicode_char]. + Override this method to define what happens when the user performs a paste operation. + Override this method to define what happens when the user performs a paste operation with middle mouse button. [b]Note:[/b] This method is only implemented on Linux. + + + + + + Adds a new caret at the given location. Returns the index of the new caret, or [code]-1[/code] if the location is invalid. + + @@ -55,14 +70,27 @@ Register a new gutter to this [TextEdit]. Use [param at] to have a specific gutter order. A value of [code]-1[/code] appends the gutter to the right. + + + + + + + + + Reposition the carets affected by the edit. This assumes edits are applied in edit order, see [method get_caret_index_edit_order]. + + + Adjust the viewport so the caret is visible. + Called when the user presses the backspace key. Can be overridden with [method _backspace]. @@ -75,6 +103,7 @@ + Centers the viewport on the line the editing caret is at. This also resets the [member scroll_horizontal] value to [code]0[/code]. @@ -93,28 +122,38 @@ + Copies the current text selection. Can be overridden with [method _copy]. + Cut's the current selection. Can be overridden with [method _cut]. + Deletes the selected text. + Deselects the current selection. + + + + Marks the end of steps in the current action started with [method start_action]. + + @@ -123,24 +162,40 @@ + Returns the column the editing caret is at. + + + + Returns the number of carets in this [TextEdit]. + + + Returns the caret pixel draw position. + + + + Returns a list of caret indexes in their edit order, this done from bottom to top. Edit order refers to the way actions such as [method insert_text_at_caret] are applied. + + + Returns the line the editing caret is on. + Returns the wrap index the editing caret is on. @@ -381,32 +436,37 @@ Returns the scroll position for [param wrap_index] of [param line]. - + + Returns the text inside the selection. + Returns the original start column of the selection. + Returns the selection begin column. + Returns the selection begin line. + Returns the original start line of the selection. @@ -419,12 +479,14 @@ + Returns the selection end column. + Returns the selection end line. @@ -476,6 +538,7 @@ + Returns a [String] text with the word under the caret's location. @@ -494,6 +557,7 @@ + Returns [code]true[/code] if the user has selected text. @@ -515,12 +579,14 @@ + Insert the specified text at the caret position. + Returns [code]true[/code] if the caret is visible on the screen. @@ -576,6 +642,7 @@ + Returns whether the mouse is over selection. If [param edges] is [code]true[/code], the edges are considered part of the selection. @@ -601,18 +668,41 @@ Merge the gutters from [param from_line] into [param to_line]. Only overwritable gutters will be copied. + + + + Merges any overlapping carets. Will favour the newest caret, or the caret with a selection. + [b]Note:[/b] 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. + + + Paste at the current location. Can be overridden with [method _paste]. + + + + + Pastes the primary clipboard. + + Perform redo operation. + + + + + Removes the given caret index. + [b]Note:[/b] This can result in adjustment of all other caret indices. + + @@ -620,6 +710,12 @@ Removes the gutter from this [TextEdit]. + + + + Removes all additional carets. + + @@ -666,6 +762,7 @@ + Perform selection, from line/column to line/column. If [member selecting_enabled] is [code]false[/code], no selection will occur. @@ -680,6 +777,7 @@ + Selects the word under the caret. @@ -688,9 +786,11 @@ + Moves the caret to the specified [param column] index. If [param adjust_viewport] is [code]true[/code], the viewport will center at the caret position after the move occurs. + [b]Note:[/b] If supporting multiple carets this will not check for any overlap. See [method merge_overlapping_carets]. @@ -699,10 +799,12 @@ + Moves the caret to the specified [param line] index. If [param adjust_viewport] is [code]true[/code], the viewport will center at the caret position after the move occurs. If [param can_be_hidden] is [code]true[/code], the specified [code]line[/code] can be hidden. + [b]Note:[/b] If supporting multiple carets this will not check for any overlap. See [method merge_overlapping_carets]. @@ -872,6 +974,7 @@ + Sets the current selection mode. @@ -890,6 +993,14 @@ Provide custom tooltip text. The callback method must take the following args: [code]hovered_word: String[/code] + + + + + Starts an action, will end the current action if [code]action[/code] is different. + An action will also end after a call to [method end_action], after [member ProjectSettings.gui/timers/text_edit_idle_detect_sec] is triggered or a new undoable step outside the [method start_action] and [method end_action] calls. + + @@ -926,6 +1037,9 @@ If [code]true[/code], a right-click moves the caret at the mouse position before displaying the context menu. If [code]false[/code], the context menu disregards mouse location. + + Sets if multiple carets are allowed. + Set the type of caret to draw. @@ -1154,6 +1268,18 @@ Represents the size of the [enum MenuItems] enum. + + No current action. + + + A typing action. + + + A backwards delete action. + + + A forward delete action. + Match case when searching. -- cgit v1.2.3