TextEdit¶
Inherits: Control < CanvasItem < Node < Object
Control de edición de texto multilínea.
Descripción¶
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.
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.
Propiedades¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
focus_mode |
|
|
|
||
|
||
|
||
|
||
|
||
|
||
mouse_default_cursor_shape |
|
|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Métodos¶
void |
add_color_region ( String begin_key, String end_key, Color color, bool line_only=false ) |
void |
add_keyword_color ( String keyword, Color color ) |
void |
|
void |
clear_colors ( ) |
void |
|
void |
copy ( ) |
cursor_get_column ( ) const |
|
cursor_get_line ( ) const |
|
void |
cursor_set_column ( int column, bool adjust_viewport=true ) |
void |
cursor_set_line ( int line, bool adjust_viewport=true, bool can_be_hidden=true, int wrap_index=0 ) |
void |
cut ( ) |
void |
deselect ( ) |
void |
fold_all_lines ( ) |
void |
|
get_breakpoints ( ) const |
|
get_keyword_color ( String keyword ) const |
|
get_line_column_at_pos ( Vector2 position ) const |
|
get_line_count ( ) const |
|
get_line_height ( ) const |
|
get_line_width ( int line, int wrap_index=-1 ) const |
|
get_line_wrap_count ( int line ) const |
|
get_line_wrapped_text ( int line ) const |
|
get_menu ( ) const |
|
get_pos_at_line_column ( int line, int column ) const |
|
get_rect_at_line_column ( int line, int column ) const |
|
get_selection_from_column ( ) const |
|
get_selection_from_line ( ) const |
|
get_selection_text ( ) const |
|
get_selection_to_column ( ) const |
|
get_selection_to_line ( ) const |
|
get_total_gutter_width ( ) const |
|
get_word_under_cursor ( ) const |
|
has_keyword_color ( String keyword ) const |
|
has_redo ( ) const |
|
has_undo ( ) const |
|
void |
insert_text_at_cursor ( String text ) |
is_line_hidden ( int line ) const |
|
is_line_set_as_bookmark ( int line ) const |
|
is_line_set_as_breakpoint ( int line ) const |
|
is_line_set_as_safe ( int line ) const |
|
is_line_wrapped ( int line ) const |
|
is_selection_active ( ) const |
|
void |
menu_option ( int option ) |
void |
paste ( ) |
void |
redo ( ) |
void |
|
search ( String key, int flags, int from_line, int from_column ) const |
|
void |
select ( int from_line, int from_column, int to_line, int to_column ) |
void |
select_all ( ) |
void |
|
void |
set_line_as_bookmark ( int line, bool bookmark ) |
void |
set_line_as_breakpoint ( int line, bool breakpoint ) |
void |
set_line_as_hidden ( int line, bool enable ) |
void |
set_line_as_safe ( int line, bool safe ) |
void |
toggle_fold_line ( int line ) |
void |
undo ( ) |
void |
unfold_line ( int line ) |
void |
unhide_all_lines ( ) |
Propiedades del Theme¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Señales¶
breakpoint_toggled ( int row )
Emitido cuando se coloca un breakpoint a través de la canaleta del breakpoint.
cursor_changed ( )
Emitido cuando el cursor cambia.
Emitido cuando se hace clic en el icono de información.
request_completion ( )
text_changed ( )
Emitido cuando el texto cambia.
Enumeraciones¶
enum SearchFlags:
SEARCH_MATCH_CASE = 1 --- Coincide con el caso cuando se busca.
SEARCH_WHOLE_WORDS = 2 --- Coincide con palabras enteras cuando se busca.
SEARCH_BACKWARDS = 4 --- Busca desde el final hasta el principio.
enum SearchResult:
SEARCH_RESULT_COLUMN = 0 --- Used to access the result column from search.
SEARCH_RESULT_LINE = 1 --- Used to access the result line from search.
MENU_CUT = 0 --- Corta (copia y borra) el texto seleccionado.
MENU_COPY = 1 --- Copia el texto seleccionado.
MENU_PASTE = 2 --- Pega el texto del portapapeles sobre el texto seleccionado (o en la posición del cursor).
MENU_CLEAR = 3 --- Borra todo el texto
TextEdit
.MENU_SELECT_ALL = 4 --- Selecciona todo el texto
TextEdit
.MENU_UNDO = 5 --- Deshace la acción anterior.
MENU_REDO = 6 --- Rehace la acción anterior.
MENU_MAX = 7 --- Representa el tamaño del enum MenuItems.
Descripciones de Propiedades¶
bool bookmark_gutter
Default |
|
Setter |
set_bookmark_gutter_enabled(value) |
Getter |
is_bookmark_gutter_enabled() |
If true
, the bookmark gutter is visible.
bool breakpoint_gutter
Default |
|
Setter |
set_breakpoint_gutter_enabled(value) |
Getter |
is_breakpoint_gutter_enabled() |
Si true
, el breakpoint es visible.
bool caret_blink
Default |
|
Setter |
cursor_set_blink_enabled(value) |
Getter |
cursor_get_blink_enabled() |
Si true
, el caret (cursor visual) parpadea.
float caret_blink_speed
Default |
|
Setter |
cursor_set_blink_speed(value) |
Getter |
cursor_get_blink_speed() |
Duración (en segundos) del ciclo de parpadeo de un caret.
bool caret_block_mode
Default |
|
Setter |
cursor_set_block_mode(value) |
Getter |
cursor_is_block_mode() |
Si true
, el caret se muestra como un rectángulo.
Si false
, el caret se muestra como una barra.
bool caret_moving_by_right_click
Default |
|
Setter |
set_right_click_moves_caret(value) |
Getter |
is_right_click_moving_caret() |
Si true
, un clic con el botón derecho mueve el cursor en la posición del ratón antes de mostrar el menú contextual.
Si false
, el menú contextual no tiene en cuenta la posición del ratón.
Default |
|
Setter |
set_context_menu_enabled(value) |
Getter |
is_context_menu_enabled() |
Si true
, un clic con el botón derecho del ratón muestra el menú contextual.
bool draw_spaces
Default |
|
Setter |
set_draw_spaces(value) |
Getter |
is_drawing_spaces() |
Si true
, el carácter "espacio" tendrá una representación visible.
bool draw_tabs
Default |
|
Setter |
set_draw_tabs(value) |
Getter |
is_drawing_tabs() |
Si true
, el carácter "tab" tendrá una representación visible.
bool fold_gutter
Default |
|
Setter |
set_draw_fold_gutter(value) |
Getter |
is_drawing_fold_gutter() |
Si true
, el canalón de pliegue es visible. Esto permite doblar grupos de líneas indentadas.
bool hiding_enabled
Default |
|
Setter |
set_hiding_enabled(value) |
Getter |
is_hiding_enabled() |
Si true
, todas las líneas que se han establecido como ocultas por set_line_as_hidden, no serán visibles.
bool highlight_all_occurrences
Default |
|
Setter |
set_highlight_all_occurrences(value) |
Getter |
is_highlight_all_occurrences_enabled() |
Si true
, se resaltarán todas las ocurrencias del texto seleccionado.
bool highlight_current_line
Default |
|
Setter |
set_highlight_current_line(value) |
Getter |
is_highlight_current_line_enabled() |
Si true
, se resalta la línea que contiene el cursor.
bool minimap_draw
Default |
|
Setter |
draw_minimap(value) |
Getter |
is_drawing_minimap() |
Si true
, se muestra un minimapa, que proporciona un esquema de su código fuente.
int minimap_width
Default |
|
Setter |
set_minimap_width(value) |
Getter |
get_minimap_width() |
El ancho, en píxeles, del minimapa.
bool override_selected_font_color
Default |
|
Setter |
set_override_selected_font_color(value) |
Getter |
is_overriding_selected_font_color() |
Si true
, se utilizará el font_color_selected
personalizado para el texto seleccionado.
bool readonly
Default |
|
Setter |
set_readonly(value) |
Getter |
is_readonly() |
Si true
, se activa el modo de sólo lectura. El texto existente no puede ser modificado y no se puede añadir texto nuevo.
int scroll_horizontal
Default |
|
Setter |
set_h_scroll(value) |
Getter |
get_h_scroll() |
If there is a horizontal scrollbar, this determines the current horizontal scroll value in pixels.
float scroll_vertical
Default |
|
Setter |
set_v_scroll(value) |
Getter |
get_v_scroll() |
If there is a vertical scrollbar, this determines the current vertical scroll value in line numbers, starting at 0 for the top line.
bool selecting_enabled
Default |
|
Setter |
set_selecting_enabled(value) |
Getter |
is_selecting_enabled() |
Si true
, se puede seleccionar el texto.
Si false
, el texto no puede ser seleccionado por el usuario o por los métodos select o select_all.
bool shortcut_keys_enabled
Default |
|
Setter |
set_shortcut_keys_enabled(value) |
Getter |
is_shortcut_keys_enabled() |
Si true
, las teclas de atajo para los elementos del menú contextual están habilitadas, incluso si el menú contextual está desactivado.
bool show_line_numbers
Default |
|
Setter |
set_show_line_numbers(value) |
Getter |
is_show_line_numbers_enabled() |
Si true
, los números de línea se muestran a la izquierda del texto.
bool smooth_scrolling
Default |
|
Setter |
set_smooth_scroll_enable(value) |
Getter |
is_smooth_scroll_enabled() |
Si true
, establece el step
de las scrollbars en 0.25
lo que resulta en un desplazamiento más suave.
bool syntax_highlighting
Default |
|
Setter |
set_syntax_coloring(value) |
Getter |
is_syntax_coloring_enabled() |
If true
, any custom color properties that have been set for this TextEdit
will be visible.
String text
Default |
|
Setter |
set_text(value) |
Getter |
get_text() |
Valor de string de TextEdit
.
float v_scroll_speed
Default |
|
Setter |
set_v_scroll_speed(value) |
Getter |
get_v_scroll_speed() |
Sensibilidad de scroll vertical.
bool virtual_keyboard_enabled
Default |
|
Setter |
set_virtual_keyboard_enabled(value) |
Getter |
is_virtual_keyboard_enabled() |
Si true
, el teclado virtual nativo se muestra cuando se enfoca en plataformas que lo soportan.
bool wrap_enabled
Default |
|
Setter |
set_wrap_enabled(value) |
Getter |
is_wrap_enabled() |
Si true
, permite la envoltura del texto cuando va más allá del borde de lo que es visible.
Descripciones de Métodos¶
Adds color region (given the delimiters) and its colors.
Adds a keyword
and its Color.
Regresa si la línea dada es plegable, es decir, tiene líneas indentadas justo debajo de ella.
void center_viewport_to_cursor ( )
Centra la vista en la línea en la que se encuentra el cursor de edición. Esto también restablece el valor de scroll_horizontal a 0
.
void clear_colors ( )
Clears all custom syntax coloring information previously added with add_color_region or add_keyword_color.
void clear_undo_history ( )
Limpia el historial de deshacer.
void copy ( )
Copiar es la selección de texto actual.
int cursor_get_column ( ) const
Devuelve la columna en la que se encuentra el cursor de edición.
int cursor_get_line ( ) const
Devuelve la línea en la que está el cursor de edición.
Mueve el cursor en el índice de la column
especificada.
Si adjust_viewport
se establece en true
, el viewport se centrará en la posición del cursor después de que se produzca el movimiento.
void cursor_set_line ( int line, bool adjust_viewport=true, bool can_be_hidden=true, int wrap_index=0 )
Mueve el cursor en el índice especificado de line
.
Si adjust_viewport
se establece en true
, el viewport se centrará en la posición del cursor después de que se produzca el movimiento.
Si can_be_hidden
se establece en true
, la línea line
especificada puede ser ocultada usando set_line_as_hidden.
void cut ( )
Corta la selección actual.
void deselect ( )
Deselecciona la selección actual.
void fold_all_lines ( )
Pliega todas las líneas que se pueden plegar (ver can_fold).
void fold_line ( int line )
Dobla la línea dada, si es posible (ver can_fold).
Array get_breakpoints ( ) const
Devuelve un array que contiene el número de línea de cada breakpoint.
Returns the Color of the specified keyword
.
Devuelve el texto de una línea específica.
Returns the line and column at the given position. In the returned vector, x
is the column, y
is the line.
int get_line_count ( ) const
Devuelve la cantidad de líneas totales en el texto.
int get_line_height ( ) const
Returns the height of a largest line.
Returns the width in pixels of the wrap_index
on line
.
Returns the number of times the given line is wrapped.
PoolStringArray get_line_wrapped_text ( int line ) const
Returns an array of Strings representing each wrapped index.
Returns the PopupMenu of this TextEdit
. By default, this menu is displayed when right-clicking on the TextEdit
.
Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their CanvasItem.visible property.
Returns the local position for the given line
and column
. If x
or y
of the returned vector equal -1
, the position is outside of the viewable area of the control.
Note: The Y position corresponds to the bottom side of the line. Use get_rect_at_line_column to get the top side position.
Returns the local position and size for the grapheme at the given line
and column
. If x
or y
position of the returned rect equal -1
, the position is outside of the viewable area of the control.
Note: The Y position of the returned rect corresponds to the top side of the line, unlike get_pos_at_line_column which returns the bottom side.
int get_selection_from_column ( ) const
Devuelve la columna de inicio de la selección.
int get_selection_from_line ( ) const
Devuelve la línea de inicio de la selección.
String get_selection_text ( ) const
Devuelve el texto dentro de la selección.
int get_selection_to_column ( ) const
Devuelve la columna de final de selección.
int get_selection_to_line ( ) const
Devuelve la línea final de selección.
int get_total_gutter_width ( ) const
Returns the total width of all gutters and internal padding.
String get_word_under_cursor ( ) const
Returns a String text with the word under the caret (text cursor) location.
Returns whether the specified keyword
has a color set to it or not.
bool has_redo ( ) const
Devuelve true
si una acción de "redo" está disponible.
bool has_undo ( ) const
Devuelve true
si se dispone de una acción de "deshacer".
void insert_text_at_cursor ( String text )
Inserta el texto especificado en la posición del cursor.
Devuelve si la línea del índice especificado está doblado o no.
Devuelve si la línea en el índice especificado está oculta o no.
Returns true
when the specified line
is bookmarked.
Returns true
when the specified line
has a breakpoint.
Returns true
when the specified line
is marked as safe.
Returns if the given line is wrapped.
bool is_selection_active ( ) const
Devuelve true
si la selección está activa.
Desencadena una acción de menú con el botón derecho del ratón por el índice especificado. Véase MenuItems para una lista de los índices disponibles.
void paste ( )
Pega la selección actual.
void redo ( )
Realiza la operación de rehacer.
void remove_breakpoints ( )
Elimina todos los breakpoints. Esto no disparará la señal breakpoint_toggled.
PoolIntArray search ( String key, int flags, int from_line, int from_column ) const
Perform a search inside the text. Search flags can be specified in the SearchFlags enum.
Returns an empty PoolIntArray
if no result was found. Otherwise, the result line and column can be accessed at indices specified in the SearchResult enum, e.g:
var result = search(key, flags, line, column)
if result.size() > 0:
# Result found.
var res_line = result[TextEdit.SEARCH_RESULT_LINE]
var res_column = result[TextEdit.SEARCH_RESULT_COLUMN]
Realiza la selección, de línea/columna a línea/columna.
Si selecting_enabled es false
, no se producirá ninguna selección.
void select_all ( )
Selecciona todo el texto.
Si selecting_enabled es false
, no se producirá ninguna selección.
Establece el texto para una línea específica.
Bookmarks the line
if bookmark
is true. Deletes the bookmark if bookmark
is false.
Bookmarks are shown in the breakpoint_gutter.
Adds or removes the breakpoint in line
. Breakpoints are shown in the breakpoint_gutter.
Si true
, oculta la línea del índice especificado.
If true
, marks the line
as safe.
This will show the line number with the color provided in the safe_line_number_color
theme property.
void toggle_fold_line ( int line )
Cambia el plegado del bloque de código en la línea dada.
void undo ( )
Realiza la operación de deshacer.
void unfold_line ( int line )
Despliega la línea dada, si se dobla.
void unhide_all_lines ( )
Deshacer todas las líneas que fueron previamente establecidas como ocultas por set_line_as_hidden.
Theme Property Descriptions¶
Color background_color
Default |
|
Establece el fondo Color de este TextEdit
. syntax_highlighting tiene que estar activada.
Color bookmark_color
Default |
|
Establece el Color del marcador. syntax_highlighting tiene que estar activado.
Color brace_mismatch_color
Default |
|
Color breakpoint_color
Default |
|
Establece el Color de los breakpoints. El breakpoint_gutter tiene que estar activado.
Color caret_background_color
Default |
|
Color caret_color
Default |
|
Color code_folding_color
Default |
|
Color completion_background_color
Default |
|
Color completion_existing_color
Default |
|
Color completion_font_color
Default |
|
Color completion_scroll_color
Default |
|
Color completion_selected_color
Default |
|
Color current_line_color
Default |
|
Establece el Color de los breakpoints. El breakpoint_gutter tiene que estar activado.
Color executing_line_color
Default |
|
Color font_color
Default |
|
Establece la fuente Color.
Color font_color_readonly
Default |
|
Color font_color_selected
Default |
|
Establece el Color del texto seleccionado. override_selected_font_color tiene que estar activado.
Color function_color
Default |
|
Color line_number_color
Default |
|
Establece el Color de los números de línea. show_line_numbers tiene que estar activado.
Color mark_color
Default |
|
Establece el Color del texto marcado.
Color member_variable_color
Default |
|
Color number_color
Default |
|
Color safe_line_number_color
Default |
|
Color selection_color
Default |
|
Establece el resaltado Color de las selecciones de texto.
Color symbol_color
Default |
|
Color word_highlighted_color
Default |
|
Establece el resaltado Color de múltiples ocurrencias. highlight_all_occurrences tiene que ser activado.
int completion_lines
Default |
|
int completion_max_width
Default |
|
int completion_scroll_width
Default |
|
int line_spacing
Default |
|
Establece el espacio entre las líneas.
Font font
Establece la Font predeterminada.
Texture fold
Texture folded
Texture space
Texture tab
Sets a custom Texture for tab text characters.
StyleBox completion
StyleBox focus
StyleBox normal
Establece el StyleBox de este TextEdit
.
StyleBox read_only
Establece el StyleBox de este TextEdit
cuando readonly está activado.