2014-02-10 01:10:30 +00:00
|
|
|
/**************************************************************************/
|
|
|
|
/* text_edit.h */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
#ifndef TEXT_EDIT_H
|
|
|
|
#define TEXT_EDIT_H
|
|
|
|
|
|
|
|
#include "scene/gui/control.h"
|
2016-05-16 23:25:17 +00:00
|
|
|
#include "scene/gui/popup_menu.h"
|
2014-02-10 01:10:30 +00:00
|
|
|
#include "scene/gui/scroll_bar.h"
|
|
|
|
#include "scene/main/timer.h"
|
2020-03-07 11:17:18 +00:00
|
|
|
#include "scene/resources/syntax_highlighter.h"
|
2020-09-18 07:36:10 +00:00
|
|
|
#include "scene/resources/text_paragraph.h"
|
2018-04-02 11:41:44 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
class TextEdit : public Control {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(TextEdit, Control);
|
2018-04-02 11:41:44 +00:00
|
|
|
|
|
|
|
public:
|
2022-06-03 16:47:37 +00:00
|
|
|
/* Edit Actions. */
|
|
|
|
enum EditAction {
|
|
|
|
ACTION_NONE,
|
|
|
|
ACTION_TYPING,
|
|
|
|
ACTION_BACKSPACE,
|
|
|
|
ACTION_DELETE,
|
|
|
|
};
|
|
|
|
|
2021-07-08 17:35:56 +00:00
|
|
|
/* Caret. */
|
|
|
|
enum CaretType {
|
|
|
|
CARET_TYPE_LINE,
|
|
|
|
CARET_TYPE_BLOCK
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Selection */
|
2020-10-11 17:44:53 +00:00
|
|
|
enum SelectionMode {
|
|
|
|
SELECTION_MODE_NONE,
|
|
|
|
SELECTION_MODE_SHIFT,
|
|
|
|
SELECTION_MODE_POINTER,
|
|
|
|
SELECTION_MODE_WORD,
|
|
|
|
SELECTION_MODE_LINE
|
|
|
|
};
|
|
|
|
|
2021-07-09 10:52:49 +00:00
|
|
|
/* Line Wrapping.*/
|
|
|
|
enum LineWrappingMode {
|
|
|
|
LINE_WRAPPING_NONE,
|
|
|
|
LINE_WRAPPING_BOUNDARY
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Gutters. */
|
|
|
|
enum GutterType {
|
|
|
|
GUTTER_TYPE_STRING,
|
|
|
|
GUTTER_TYPE_ICON,
|
|
|
|
GUTTER_TYPE_CUSTOM
|
|
|
|
};
|
|
|
|
|
Fix various typos
Found via ` codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint,varn`
Update editor/import/resource_importer_layered_texture.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update doc/classes/TileSetScenesCollectionSource.xml
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/graph_edit.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/rich_text_label.cpp
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Revert previously committed change
2022-01-02 06:03:58 +00:00
|
|
|
/* Context Menu. */
|
2021-07-10 10:41:38 +00:00
|
|
|
enum MenuItems {
|
|
|
|
MENU_CUT,
|
|
|
|
MENU_COPY,
|
|
|
|
MENU_PASTE,
|
|
|
|
MENU_CLEAR,
|
|
|
|
MENU_SELECT_ALL,
|
|
|
|
MENU_UNDO,
|
|
|
|
MENU_REDO,
|
2023-01-26 17:59:41 +00:00
|
|
|
MENU_SUBMENU_TEXT_DIR,
|
2021-07-10 10:41:38 +00:00
|
|
|
MENU_DIR_INHERITED,
|
|
|
|
MENU_DIR_AUTO,
|
|
|
|
MENU_DIR_LTR,
|
|
|
|
MENU_DIR_RTL,
|
|
|
|
MENU_DISPLAY_UCC,
|
2023-01-26 17:59:41 +00:00
|
|
|
MENU_SUBMENU_INSERT_UCC,
|
2021-07-10 10:41:38 +00:00
|
|
|
MENU_INSERT_LRM,
|
|
|
|
MENU_INSERT_RLM,
|
|
|
|
MENU_INSERT_LRE,
|
|
|
|
MENU_INSERT_RLE,
|
|
|
|
MENU_INSERT_LRO,
|
|
|
|
MENU_INSERT_RLO,
|
|
|
|
MENU_INSERT_PDF,
|
|
|
|
MENU_INSERT_ALM,
|
|
|
|
MENU_INSERT_LRI,
|
|
|
|
MENU_INSERT_RLI,
|
|
|
|
MENU_INSERT_FSI,
|
|
|
|
MENU_INSERT_PDI,
|
|
|
|
MENU_INSERT_ZWJ,
|
|
|
|
MENU_INSERT_ZWNJ,
|
|
|
|
MENU_INSERT_WJ,
|
|
|
|
MENU_INSERT_SHY,
|
|
|
|
MENU_MAX
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Search. */
|
|
|
|
enum SearchFlags {
|
|
|
|
SEARCH_MATCH_CASE = 1,
|
|
|
|
SEARCH_WHOLE_WORDS = 2,
|
|
|
|
SEARCH_BACKWARDS = 4
|
|
|
|
};
|
|
|
|
|
2020-07-25 00:15:23 +00:00
|
|
|
private:
|
|
|
|
struct GutterInfo {
|
|
|
|
GutterType type = GutterType::GUTTER_TYPE_STRING;
|
|
|
|
String name = "";
|
|
|
|
int width = 24;
|
|
|
|
bool draw = true;
|
|
|
|
bool clickable = false;
|
|
|
|
bool overwritable = false;
|
|
|
|
|
2021-11-07 17:26:15 +00:00
|
|
|
Callable custom_draw_callback;
|
2020-07-25 00:15:23 +00:00
|
|
|
};
|
|
|
|
|
2018-04-02 11:41:44 +00:00
|
|
|
class Text {
|
|
|
|
public:
|
2020-07-25 00:15:23 +00:00
|
|
|
struct Gutter {
|
|
|
|
Variant metadata;
|
|
|
|
bool clickable = false;
|
|
|
|
|
2024-06-21 16:19:04 +00:00
|
|
|
Ref<Texture2D> icon;
|
2020-07-25 00:15:23 +00:00
|
|
|
String text = "";
|
|
|
|
Color color = Color(1, 1, 1);
|
|
|
|
};
|
|
|
|
|
2018-04-02 11:41:44 +00:00
|
|
|
struct Line {
|
2020-07-25 00:15:23 +00:00
|
|
|
Vector<Gutter> gutters;
|
|
|
|
|
2020-09-18 07:36:10 +00:00
|
|
|
String data;
|
2021-08-27 21:19:51 +00:00
|
|
|
Array bidi_override;
|
2020-09-18 07:36:10 +00:00
|
|
|
Ref<TextParagraph> data_buf;
|
|
|
|
|
2020-09-10 20:25:00 +00:00
|
|
|
Color background_color = Color(0, 0, 0, 0);
|
2021-02-09 17:24:36 +00:00
|
|
|
bool hidden = false;
|
2024-08-12 01:58:26 +00:00
|
|
|
int line_count = 0;
|
2021-08-27 19:05:05 +00:00
|
|
|
int height = 0;
|
|
|
|
int width = 0;
|
2020-09-18 07:36:10 +00:00
|
|
|
|
2019-12-10 04:13:02 +00:00
|
|
|
Line() {
|
2021-06-17 22:03:09 +00:00
|
|
|
data_buf.instantiate();
|
2019-12-10 04:13:02 +00:00
|
|
|
}
|
2018-04-02 11:41:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2021-08-12 18:47:29 +00:00
|
|
|
bool is_dirty = false;
|
2021-08-27 19:05:05 +00:00
|
|
|
bool tab_size_dirty = false;
|
2021-08-12 18:47:29 +00:00
|
|
|
|
2018-04-02 11:41:44 +00:00
|
|
|
mutable Vector<Line> text;
|
|
|
|
Ref<Font> font;
|
2020-09-18 07:36:10 +00:00
|
|
|
int font_size = -1;
|
2021-12-08 15:29:40 +00:00
|
|
|
int font_height = 0;
|
2020-09-18 07:36:10 +00:00
|
|
|
|
|
|
|
String language;
|
|
|
|
TextServer::Direction direction = TextServer::DIRECTION_AUTO;
|
2023-03-12 11:21:00 +00:00
|
|
|
BitField<TextServer::LineBreakFlag> brk_flags = TextServer::BREAK_MANDATORY;
|
2020-09-18 07:36:10 +00:00
|
|
|
bool draw_control_chars = false;
|
2024-05-29 11:06:43 +00:00
|
|
|
String custom_word_separators;
|
|
|
|
bool use_default_word_separators = true;
|
|
|
|
bool use_custom_word_separators = false;
|
2020-09-18 07:36:10 +00:00
|
|
|
|
2024-08-12 01:58:26 +00:00
|
|
|
mutable bool max_line_width_dirty = true;
|
|
|
|
mutable bool max_line_height_dirty = true;
|
|
|
|
mutable int max_line_width = 0;
|
|
|
|
mutable int max_line_height = 0;
|
|
|
|
mutable int total_visible_line_count = 0;
|
2020-09-18 07:36:10 +00:00
|
|
|
int width = -1;
|
|
|
|
|
2021-06-15 14:05:01 +00:00
|
|
|
int tab_size = 4;
|
2020-07-25 00:15:23 +00:00
|
|
|
int gutter_count = 0;
|
2024-02-19 11:41:12 +00:00
|
|
|
bool indent_wrapped_lines = false;
|
2018-04-02 11:41:44 +00:00
|
|
|
|
2024-08-12 01:58:26 +00:00
|
|
|
void _calculate_line_height() const;
|
|
|
|
void _calculate_max_line_width() const;
|
2021-08-27 19:05:05 +00:00
|
|
|
|
2018-04-02 11:41:44 +00:00
|
|
|
public:
|
2021-06-15 14:05:01 +00:00
|
|
|
void set_tab_size(int p_tab_size);
|
|
|
|
int get_tab_size() const;
|
2024-02-19 11:41:12 +00:00
|
|
|
void set_indent_wrapped_lines(bool p_enabled);
|
|
|
|
bool is_indent_wrapped_lines() const;
|
|
|
|
|
2018-04-02 11:41:44 +00:00
|
|
|
void set_font(const Ref<Font> &p_font);
|
2020-09-18 07:36:10 +00:00
|
|
|
void set_font_size(int p_font_size);
|
2021-07-10 10:41:38 +00:00
|
|
|
void set_direction_and_language(TextServer::Direction p_direction, const String &p_language);
|
2021-10-08 21:26:13 +00:00
|
|
|
void set_draw_control_chars(bool p_enabled);
|
2020-09-18 07:36:10 +00:00
|
|
|
|
2021-08-27 19:05:05 +00:00
|
|
|
int get_line_height() const;
|
2021-03-13 14:09:49 +00:00
|
|
|
int get_line_width(int p_line, int p_wrap_index = -1) const;
|
2021-08-27 19:05:05 +00:00
|
|
|
int get_max_width() const;
|
2024-08-12 01:58:26 +00:00
|
|
|
int get_total_visible_line_count() const;
|
2020-09-18 07:36:10 +00:00
|
|
|
|
2024-05-29 11:06:43 +00:00
|
|
|
void set_use_default_word_separators(bool p_enabled);
|
|
|
|
bool is_default_word_separators_enabled() const;
|
|
|
|
|
|
|
|
void set_use_custom_word_separators(bool p_enabled);
|
|
|
|
bool is_custom_word_separators_enabled() const;
|
|
|
|
|
|
|
|
void set_word_separators(const String &p_separators);
|
|
|
|
void set_custom_word_separators(const String &p_separators);
|
|
|
|
String get_enabled_word_separators() const;
|
|
|
|
String get_custom_word_separators() const;
|
|
|
|
String get_default_word_separators() const;
|
|
|
|
|
2020-09-18 07:36:10 +00:00
|
|
|
void set_width(float p_width);
|
2022-01-23 20:07:35 +00:00
|
|
|
float get_width() const;
|
2023-03-12 11:21:00 +00:00
|
|
|
void set_brk_flags(BitField<TextServer::LineBreakFlag> p_flags);
|
|
|
|
BitField<TextServer::LineBreakFlag> get_brk_flags() const;
|
2018-01-26 01:41:17 +00:00
|
|
|
int get_line_wrap_amount(int p_line) const;
|
2020-09-10 20:25:00 +00:00
|
|
|
|
2020-09-18 07:36:10 +00:00
|
|
|
Vector<Vector2i> get_line_wrap_ranges(int p_line) const;
|
|
|
|
const Ref<TextParagraph> get_line_data(int p_line) const;
|
|
|
|
|
2021-08-27 21:19:51 +00:00
|
|
|
void set(int p_line, const String &p_text, const Array &p_bidi_override);
|
2024-08-12 01:58:26 +00:00
|
|
|
void set_hidden(int p_line, bool p_hidden);
|
|
|
|
bool is_hidden(int p_line) const;
|
2021-12-08 15:29:40 +00:00
|
|
|
void insert(int p_at, const Vector<String> &p_text, const Vector<Array> &p_bidi_override);
|
|
|
|
void remove_range(int p_from_line, int p_to_line);
|
2018-04-02 11:41:44 +00:00
|
|
|
int size() const { return text.size(); }
|
|
|
|
void clear();
|
2020-09-18 07:36:10 +00:00
|
|
|
|
2022-01-20 07:30:42 +00:00
|
|
|
void invalidate_cache(int p_line, int p_column = -1, bool p_text_changed = false, const String &p_ime_text = String(), const Array &p_bidi_override = Array());
|
|
|
|
void invalidate_font();
|
2020-09-18 07:36:10 +00:00
|
|
|
void invalidate_all();
|
|
|
|
void invalidate_all_lines();
|
|
|
|
|
2024-08-12 01:58:26 +00:00
|
|
|
_FORCE_INLINE_ String operator[](int p_line) const;
|
2020-07-25 00:15:23 +00:00
|
|
|
|
|
|
|
/* Gutters. */
|
|
|
|
void add_gutter(int p_at);
|
|
|
|
void remove_gutter(int p_gutter);
|
|
|
|
void move_gutters(int p_from_line, int p_to_line);
|
|
|
|
|
|
|
|
void set_line_gutter_metadata(int p_line, int p_gutter, const Variant &p_metadata) { text.write[p_line].gutters.write[p_gutter].metadata = p_metadata; }
|
|
|
|
const Variant &get_line_gutter_metadata(int p_line, int p_gutter) const { return text[p_line].gutters[p_gutter].metadata; }
|
|
|
|
|
|
|
|
void set_line_gutter_text(int p_line, int p_gutter, const String &p_text) { text.write[p_line].gutters.write[p_gutter].text = p_text; }
|
|
|
|
const String &get_line_gutter_text(int p_line, int p_gutter) const { return text[p_line].gutters[p_gutter].text; }
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
void set_line_gutter_icon(int p_line, int p_gutter, const Ref<Texture2D> &p_icon) { text.write[p_line].gutters.write[p_gutter].icon = p_icon; }
|
2020-07-25 00:15:23 +00:00
|
|
|
const Ref<Texture2D> &get_line_gutter_icon(int p_line, int p_gutter) const { return text[p_line].gutters[p_gutter].icon; }
|
|
|
|
|
|
|
|
void set_line_gutter_item_color(int p_line, int p_gutter, const Color &p_color) { text.write[p_line].gutters.write[p_gutter].color = p_color; }
|
|
|
|
const Color &get_line_gutter_item_color(int p_line, int p_gutter) const { return text[p_line].gutters[p_gutter].color; }
|
|
|
|
|
|
|
|
void set_line_gutter_clickable(int p_line, int p_gutter, bool p_clickable) { text.write[p_line].gutters.write[p_gutter].clickable = p_clickable; }
|
|
|
|
bool is_line_gutter_clickable(int p_line, int p_gutter) const { return text[p_line].gutters[p_gutter].clickable; }
|
2020-09-10 20:25:00 +00:00
|
|
|
|
|
|
|
/* Line style. */
|
|
|
|
void set_line_background_color(int p_line, const Color &p_color) { text.write[p_line].background_color = p_color; }
|
|
|
|
const Color get_line_background_color(int p_line) const { return text[p_line].background_color; }
|
2018-04-02 11:41:44 +00:00
|
|
|
};
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
/* Text */
|
|
|
|
Text text;
|
|
|
|
|
|
|
|
bool setting_text = false;
|
|
|
|
|
2021-11-29 14:24:02 +00:00
|
|
|
bool alt_start = false;
|
2024-09-05 07:52:29 +00:00
|
|
|
bool alt_start_no_hold = false;
|
2021-11-29 14:24:02 +00:00
|
|
|
uint32_t alt_code = 0;
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
// Text properties.
|
|
|
|
String ime_text = "";
|
|
|
|
Point2 ime_selection;
|
|
|
|
|
2022-01-23 20:07:35 +00:00
|
|
|
// Placeholder
|
|
|
|
String placeholder_text = "";
|
|
|
|
Array placeholder_bidi_override;
|
|
|
|
Ref<TextParagraph> placeholder_data_buf;
|
|
|
|
int placeholder_line_height = -1;
|
|
|
|
int placeholder_max_width = -1;
|
|
|
|
|
|
|
|
Vector<String> placeholder_wraped_rows;
|
|
|
|
|
|
|
|
void _update_placeholder();
|
2024-07-27 21:14:51 +00:00
|
|
|
bool _using_placeholder() const;
|
2022-01-23 20:07:35 +00:00
|
|
|
|
2023-01-21 11:25:29 +00:00
|
|
|
/* Initialize to opposite first, so we get past the early-out in set_editable. */
|
2021-07-09 13:05:52 +00:00
|
|
|
bool editable = false;
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
TextDirection text_direction = TEXT_DIRECTION_AUTO;
|
|
|
|
TextDirection input_direction = TEXT_DIRECTION_LTR;
|
|
|
|
|
|
|
|
String language = "";
|
|
|
|
|
2022-04-19 10:27:18 +00:00
|
|
|
TextServer::StructuredTextParser st_parser = TextServer::STRUCTURED_TEXT_DEFAULT;
|
2021-07-10 10:41:38 +00:00
|
|
|
Array st_args;
|
|
|
|
|
|
|
|
void _clear();
|
|
|
|
void _update_caches();
|
|
|
|
|
2024-01-22 17:34:12 +00:00
|
|
|
void _close_ime_window();
|
|
|
|
void _update_ime_window_position();
|
|
|
|
void _update_ime_text();
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
// User control.
|
2021-07-09 12:40:05 +00:00
|
|
|
bool overtype_mode = false;
|
2021-07-10 10:41:38 +00:00
|
|
|
bool context_menu_enabled = true;
|
|
|
|
bool shortcut_keys_enabled = true;
|
|
|
|
bool virtual_keyboard_enabled = true;
|
2021-10-12 07:43:50 +00:00
|
|
|
bool middle_mouse_paste_enabled = true;
|
2024-04-16 09:34:01 +00:00
|
|
|
bool empty_selection_clipboard_enabled = true;
|
2021-07-09 12:40:05 +00:00
|
|
|
|
2021-11-18 15:55:43 +00:00
|
|
|
// Overridable actions.
|
2021-07-08 15:48:58 +00:00
|
|
|
String cut_copy_line = "";
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
// Context menu.
|
|
|
|
PopupMenu *menu = nullptr;
|
|
|
|
PopupMenu *menu_dir = nullptr;
|
|
|
|
PopupMenu *menu_ctl = nullptr;
|
|
|
|
|
2021-08-13 21:31:57 +00:00
|
|
|
Key _get_menu_action_accelerator(const String &p_action);
|
2023-01-26 17:59:41 +00:00
|
|
|
void _generate_context_menu();
|
|
|
|
void _update_context_menu();
|
2021-07-10 10:41:38 +00:00
|
|
|
|
|
|
|
/* Versioning */
|
2022-06-03 16:47:37 +00:00
|
|
|
struct Caret;
|
2021-07-10 10:41:38 +00:00
|
|
|
struct TextOperation {
|
|
|
|
enum Type {
|
|
|
|
TYPE_NONE,
|
|
|
|
TYPE_INSERT,
|
|
|
|
TYPE_REMOVE
|
|
|
|
};
|
2022-06-03 16:47:37 +00:00
|
|
|
Vector<Caret> start_carets;
|
|
|
|
Vector<Caret> end_carets;
|
2021-07-10 10:41:38 +00:00
|
|
|
|
|
|
|
Type type = TYPE_NONE;
|
|
|
|
int from_line = 0;
|
|
|
|
int from_column = 0;
|
|
|
|
int to_line = 0;
|
|
|
|
int to_column = 0;
|
|
|
|
String text;
|
|
|
|
uint32_t prev_version = 0;
|
|
|
|
uint32_t version = 0;
|
|
|
|
bool chain_forward = false;
|
|
|
|
bool chain_backward = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool undo_enabled = true;
|
|
|
|
int undo_stack_max_size = 50;
|
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
EditAction current_action = EditAction::ACTION_NONE;
|
|
|
|
bool pending_action_end = false;
|
|
|
|
bool in_action = false;
|
|
|
|
|
2021-08-28 11:23:51 +00:00
|
|
|
int complex_operation_count = 0;
|
2021-07-10 10:41:38 +00:00
|
|
|
bool next_operation_is_complex = false;
|
|
|
|
|
|
|
|
TextOperation current_op;
|
|
|
|
List<TextOperation> undo_stack;
|
|
|
|
List<TextOperation>::Element *undo_stack_pos = nullptr;
|
|
|
|
|
2022-04-04 13:06:57 +00:00
|
|
|
Timer *idle_detect = nullptr;
|
2021-07-10 10:41:38 +00:00
|
|
|
|
|
|
|
uint32_t version = 0;
|
|
|
|
uint32_t saved_version = 0;
|
|
|
|
|
|
|
|
void _push_current_op();
|
|
|
|
void _do_text_op(const TextOperation &p_op, bool p_reverse);
|
|
|
|
void _clear_redo();
|
|
|
|
|
|
|
|
/* Search */
|
|
|
|
String search_text = "";
|
|
|
|
uint32_t search_flags = 0;
|
|
|
|
|
|
|
|
int _get_column_pos_of_word(const String &p_key, const String &p_search, uint32_t p_search_flags, int p_from_column) const;
|
|
|
|
|
|
|
|
/* Tooltip. */
|
2021-11-07 17:26:15 +00:00
|
|
|
Callable tooltip_callback;
|
2021-07-10 10:41:38 +00:00
|
|
|
|
|
|
|
/* Mouse */
|
2021-11-18 15:55:43 +00:00
|
|
|
struct LineDrawingCache {
|
|
|
|
int y_offset = 0;
|
|
|
|
Vector<int> first_visible_chars;
|
|
|
|
Vector<int> last_visible_chars;
|
|
|
|
};
|
|
|
|
|
2022-05-13 13:04:37 +00:00
|
|
|
HashMap<int, LineDrawingCache> line_drawing_cache;
|
2021-11-18 15:55:43 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
int _get_char_pos_for_line(int p_px, int p_line, int p_wrap_index = 0) const;
|
|
|
|
|
2021-07-09 10:52:49 +00:00
|
|
|
/* Caret. */
|
2022-04-29 15:23:32 +00:00
|
|
|
struct Selection {
|
|
|
|
bool active = false;
|
|
|
|
|
2024-01-22 23:26:16 +00:00
|
|
|
int origin_line = 0;
|
|
|
|
int origin_column = 0;
|
|
|
|
int origin_last_fit_x = 0;
|
|
|
|
int word_begin_column = 0;
|
|
|
|
int word_end_column = 0;
|
2022-04-29 15:23:32 +00:00
|
|
|
};
|
|
|
|
|
2021-07-08 17:35:56 +00:00
|
|
|
struct Caret {
|
2022-04-29 15:23:32 +00:00
|
|
|
Selection selection;
|
|
|
|
|
2020-09-13 20:14:20 +00:00
|
|
|
Point2 draw_pos;
|
|
|
|
bool visible = false;
|
2021-02-09 17:24:36 +00:00
|
|
|
int last_fit_x = 0;
|
|
|
|
int line = 0;
|
2021-07-08 17:35:56 +00:00
|
|
|
int column = 0;
|
2022-06-03 16:47:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Vector containing all the carets, index '0' is the "main caret" and should never be removed.
|
|
|
|
Vector<Caret> carets;
|
2021-07-08 17:35:56 +00:00
|
|
|
|
|
|
|
bool setting_caret_line = false;
|
|
|
|
bool caret_pos_dirty = false;
|
2024-01-22 23:27:19 +00:00
|
|
|
|
|
|
|
int multicaret_edit_count = 0;
|
|
|
|
bool multicaret_edit_merge_queued = false;
|
|
|
|
HashSet<int> multicaret_edit_ignore_carets;
|
2021-07-08 17:35:56 +00:00
|
|
|
|
|
|
|
CaretType caret_type = CaretType::CARET_TYPE_LINE;
|
|
|
|
|
|
|
|
bool draw_caret = true;
|
2023-02-07 23:02:48 +00:00
|
|
|
bool draw_caret_when_editable_disabled = false;
|
2021-07-08 17:35:56 +00:00
|
|
|
|
|
|
|
bool caret_blink_enabled = false;
|
2022-04-04 13:06:57 +00:00
|
|
|
Timer *caret_blink_timer = nullptr;
|
2021-07-08 17:35:56 +00:00
|
|
|
|
|
|
|
bool move_caret_on_right_click = true;
|
|
|
|
|
2023-08-15 08:42:40 +00:00
|
|
|
bool caret_mid_grapheme_enabled = false;
|
2021-07-08 17:35:56 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
bool multi_carets_enabled = true;
|
|
|
|
|
2021-11-24 21:22:40 +00:00
|
|
|
bool drag_action = false;
|
|
|
|
bool drag_caret_force_displayed = false;
|
|
|
|
|
2024-01-22 23:26:16 +00:00
|
|
|
void _caret_changed(int p_caret = -1);
|
2021-07-08 17:35:56 +00:00
|
|
|
void _emit_caret_changed();
|
|
|
|
|
2024-08-12 01:58:26 +00:00
|
|
|
void _show_virtual_keyboard();
|
2021-07-08 17:35:56 +00:00
|
|
|
void _reset_caret_blink_timer();
|
|
|
|
void _toggle_draw_caret();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
int _get_column_x_offset_for_line(int p_char, int p_line, int p_column) const;
|
2024-01-22 23:26:16 +00:00
|
|
|
bool _is_line_col_in_range(int p_line, int p_column, int p_from_line, int p_from_column, int p_to_line, int p_to_column, bool p_include_edges = true) const;
|
|
|
|
|
2024-01-22 23:27:19 +00:00
|
|
|
void _offset_carets_after(int p_old_line, int p_old_column, int p_new_line, int p_new_column, bool p_include_selection_begin = true, bool p_include_selection_end = true);
|
|
|
|
|
2024-01-22 23:26:16 +00:00
|
|
|
void _cancel_drag_and_drop_text();
|
2021-07-10 10:41:38 +00:00
|
|
|
|
2021-07-09 10:52:49 +00:00
|
|
|
/* Selection. */
|
2022-04-29 15:23:32 +00:00
|
|
|
SelectionMode selecting_mode = SelectionMode::SELECTION_MODE_NONE;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-07-09 11:42:55 +00:00
|
|
|
bool selecting_enabled = true;
|
2021-10-21 21:02:46 +00:00
|
|
|
bool deselect_on_focus_loss_enabled = true;
|
2022-06-19 14:55:13 +00:00
|
|
|
bool drag_and_drop_selection_enabled = true;
|
2021-07-09 11:42:55 +00:00
|
|
|
|
2022-10-25 22:46:06 +00:00
|
|
|
bool use_selected_font_color = false;
|
2021-07-09 11:42:55 +00:00
|
|
|
|
2022-04-29 15:23:32 +00:00
|
|
|
bool selection_drag_attempt = false;
|
2021-07-09 11:42:55 +00:00
|
|
|
bool dragging_selection = false;
|
2024-01-22 23:26:16 +00:00
|
|
|
int drag_and_drop_origin_caret_index = -1;
|
|
|
|
int drag_caret_index = -1;
|
2021-07-09 11:42:55 +00:00
|
|
|
|
2022-04-04 13:06:57 +00:00
|
|
|
Timer *click_select_held = nullptr;
|
2021-07-09 11:42:55 +00:00
|
|
|
uint64_t last_dblclk = 0;
|
|
|
|
Vector2 last_dblclk_pos;
|
2024-01-22 23:26:16 +00:00
|
|
|
|
|
|
|
void _selection_changed(int p_caret = -1);
|
2021-07-09 11:42:55 +00:00
|
|
|
void _click_selection_held();
|
|
|
|
|
2024-01-22 23:26:16 +00:00
|
|
|
void _update_selection_mode_pointer(bool p_initial = false);
|
|
|
|
void _update_selection_mode_word(bool p_initial = false);
|
|
|
|
void _update_selection_mode_line(bool p_initial = false);
|
2021-07-09 11:42:55 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
void _pre_shift_selection(int p_caret);
|
2024-01-22 23:26:16 +00:00
|
|
|
|
|
|
|
bool _selection_contains(int p_caret, int p_line, int p_column, bool p_include_edges = true, bool p_only_selections = true) const;
|
2021-07-09 11:42:55 +00:00
|
|
|
|
2021-11-18 15:55:43 +00:00
|
|
|
/* Line wrapping. */
|
2021-07-09 10:52:49 +00:00
|
|
|
LineWrappingMode line_wrapping_mode = LineWrappingMode::LINE_WRAPPING_NONE;
|
2023-03-12 11:21:00 +00:00
|
|
|
TextServer::AutowrapMode autowrap_mode = TextServer::AUTOWRAP_WORD_SMART;
|
2021-07-09 10:52:49 +00:00
|
|
|
|
|
|
|
int wrap_at_column = 0;
|
|
|
|
int wrap_right_offset = 10;
|
|
|
|
|
|
|
|
void _update_wrap_at_column(bool p_force = false);
|
|
|
|
|
2021-07-09 16:27:09 +00:00
|
|
|
/* Viewport. */
|
2022-04-04 13:06:57 +00:00
|
|
|
HScrollBar *h_scroll = nullptr;
|
|
|
|
VScrollBar *v_scroll = nullptr;
|
2021-07-09 16:27:09 +00:00
|
|
|
|
2024-03-17 23:19:17 +00:00
|
|
|
Vector2i content_size_cache;
|
2022-06-20 23:19:54 +00:00
|
|
|
bool fit_content_height = false;
|
2024-03-17 23:19:17 +00:00
|
|
|
bool fit_content_width = false;
|
2021-07-09 16:27:09 +00:00
|
|
|
bool scroll_past_end_of_file_enabled = false;
|
|
|
|
|
|
|
|
// Smooth scrolling.
|
|
|
|
bool smooth_scroll_enabled = false;
|
|
|
|
float target_v_scroll = 0.0;
|
|
|
|
float v_scroll_speed = 80.0;
|
|
|
|
|
|
|
|
// Scrolling.
|
2022-04-29 15:23:32 +00:00
|
|
|
int first_visible_line = 0;
|
|
|
|
int first_visible_line_wrap_ofs = 0;
|
|
|
|
int first_visible_col = 0;
|
|
|
|
|
2021-07-09 16:27:09 +00:00
|
|
|
bool scrolling = false;
|
|
|
|
bool updating_scrolls = false;
|
|
|
|
|
|
|
|
void _update_scrollbars();
|
2021-07-10 10:41:38 +00:00
|
|
|
int _get_control_height() const;
|
2021-07-09 16:27:09 +00:00
|
|
|
|
|
|
|
void _v_scroll_input();
|
|
|
|
void _scroll_moved(double p_to_val);
|
|
|
|
|
|
|
|
double _get_visible_lines_offset() const;
|
|
|
|
double _get_v_scroll_offset() const;
|
|
|
|
|
2023-02-17 13:50:46 +00:00
|
|
|
void _scroll_up(real_t p_delta, bool p_animate);
|
|
|
|
void _scroll_down(real_t p_delta, bool p_animate);
|
2021-07-09 16:27:09 +00:00
|
|
|
|
|
|
|
void _scroll_lines_up();
|
|
|
|
void _scroll_lines_down();
|
|
|
|
|
2021-11-18 15:55:43 +00:00
|
|
|
// Minimap.
|
2021-07-09 16:27:09 +00:00
|
|
|
bool draw_minimap = false;
|
|
|
|
|
|
|
|
int minimap_width = 80;
|
|
|
|
Point2 minimap_char_size = Point2(1, 2);
|
|
|
|
int minimap_line_spacing = 1;
|
|
|
|
|
2021-11-18 15:55:43 +00:00
|
|
|
// Minimap scroll.
|
2021-07-09 16:27:09 +00:00
|
|
|
bool minimap_clicked = false;
|
2020-02-02 18:47:33 +00:00
|
|
|
bool hovering_minimap = false;
|
2021-07-09 16:27:09 +00:00
|
|
|
bool dragging_minimap = false;
|
|
|
|
bool can_drag_minimap = false;
|
|
|
|
|
|
|
|
double minimap_scroll_ratio = 0.0;
|
|
|
|
double minimap_scroll_click_pos = 0.0;
|
|
|
|
|
2020-02-02 18:47:33 +00:00
|
|
|
void _update_minimap_hover();
|
2021-07-09 16:27:09 +00:00
|
|
|
void _update_minimap_click();
|
|
|
|
void _update_minimap_drag();
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
/* Gutters. */
|
|
|
|
Vector<GutterInfo> gutters;
|
|
|
|
int gutters_width = 0;
|
|
|
|
int gutter_padding = 0;
|
2021-09-29 09:37:27 +00:00
|
|
|
Vector2i hovered_gutter = Vector2i(-1, -1); // X = gutter index, Y = row.
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
void _update_gutter_width();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
/* Syntax highlighting. */
|
2020-03-07 11:17:18 +00:00
|
|
|
Ref<SyntaxHighlighter> syntax_highlighter;
|
2024-08-12 01:58:26 +00:00
|
|
|
HashMap<int, Vector<Pair<int64_t, Color>>> syntax_highlighting_cache;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2024-08-12 01:58:26 +00:00
|
|
|
Vector<Pair<int64_t, Color>> _get_line_syntax_highlighting(int p_line);
|
|
|
|
void _clear_syntax_highlighting_cache();
|
2018-04-02 11:41:44 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
/* Visual. */
|
2023-04-03 16:01:10 +00:00
|
|
|
struct ThemeCache {
|
|
|
|
float base_scale = 1.0;
|
|
|
|
|
|
|
|
/* Search */
|
|
|
|
Color search_result_color = Color(1, 1, 1);
|
|
|
|
Color search_result_border_color = Color(1, 1, 1);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2023-04-03 16:01:10 +00:00
|
|
|
/* Caret */
|
|
|
|
int caret_width = 1;
|
|
|
|
Color caret_color = Color(1, 1, 1);
|
|
|
|
Color caret_background_color = Color(0, 0, 0);
|
2020-09-18 07:36:10 +00:00
|
|
|
|
2023-04-03 16:01:10 +00:00
|
|
|
/* Selection */
|
|
|
|
Color font_selected_color = Color(0, 0, 0, 0);
|
|
|
|
Color selection_color = Color(1, 1, 1);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2023-04-03 16:01:10 +00:00
|
|
|
/* Other visuals */
|
|
|
|
Ref<StyleBox> style_normal;
|
|
|
|
Ref<StyleBox> style_focus;
|
|
|
|
Ref<StyleBox> style_readonly;
|
|
|
|
|
|
|
|
Ref<Texture2D> tab_icon;
|
|
|
|
Ref<Texture2D> space_icon;
|
|
|
|
|
|
|
|
Ref<Font> font;
|
|
|
|
int font_size = 16;
|
|
|
|
Color font_color = Color(1, 1, 1);
|
|
|
|
Color font_readonly_color = Color(1, 1, 1);
|
|
|
|
Color font_placeholder_color = Color(1, 1, 1, 0.6);
|
2021-07-10 10:41:38 +00:00
|
|
|
|
2023-04-03 16:01:10 +00:00
|
|
|
int outline_size = 0;
|
|
|
|
Color outline_color = Color(1, 1, 1);
|
|
|
|
|
|
|
|
int line_spacing = 1;
|
|
|
|
|
|
|
|
Color background_color = Color(1, 1, 1);
|
|
|
|
Color current_line_color = Color(1, 1, 1);
|
|
|
|
Color word_highlighted_color = Color(1, 1, 1);
|
|
|
|
} theme_cache;
|
2016-05-09 18:21:55 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
bool window_has_focus = true;
|
2021-02-09 17:24:36 +00:00
|
|
|
bool first_draw = true;
|
|
|
|
|
|
|
|
bool highlight_current_line = false;
|
2021-07-10 10:41:38 +00:00
|
|
|
bool highlight_all_occurrences = false;
|
|
|
|
bool draw_control_chars = false;
|
|
|
|
bool draw_tabs = false;
|
|
|
|
bool draw_spaces = false;
|
2020-09-13 20:14:20 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
/*** Super internal Core API. Everything builds on it. ***/
|
|
|
|
bool text_changed_dirty = false;
|
2024-01-22 23:26:16 +00:00
|
|
|
void _text_changed();
|
|
|
|
void _emit_text_changed();
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
void _insert_text(int p_line, int p_char, const String &p_text, int *r_end_line = nullptr, int *r_end_char = nullptr);
|
|
|
|
void _remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column);
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-08-11 19:10:05 +00:00
|
|
|
void _base_insert_text(int p_line, int p_char, const String &p_text, int &r_end_line, int &r_end_column);
|
2014-02-10 01:10:30 +00:00
|
|
|
String _base_get_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column) const;
|
|
|
|
void _base_remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column);
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
/* Input actions. */
|
2020-12-07 11:32:00 +00:00
|
|
|
void _swap_current_input_direction();
|
|
|
|
void _new_line(bool p_split_current = true, bool p_above = false);
|
2021-07-08 17:35:56 +00:00
|
|
|
void _move_caret_left(bool p_select, bool p_move_by_word = false);
|
|
|
|
void _move_caret_right(bool p_select, bool p_move_by_word = false);
|
|
|
|
void _move_caret_up(bool p_select);
|
|
|
|
void _move_caret_down(bool p_select);
|
|
|
|
void _move_caret_to_line_start(bool p_select);
|
|
|
|
void _move_caret_to_line_end(bool p_select);
|
|
|
|
void _move_caret_page_up(bool p_select);
|
|
|
|
void _move_caret_page_down(bool p_select);
|
2021-06-15 14:05:01 +00:00
|
|
|
void _do_backspace(bool p_word = false, bool p_all_to_left = false);
|
2020-12-07 11:32:00 +00:00
|
|
|
void _delete(bool p_word = false, bool p_all_to_right = false);
|
2021-07-08 17:35:56 +00:00
|
|
|
void _move_caret_document_start(bool p_select);
|
|
|
|
void _move_caret_document_end(bool p_select);
|
2022-11-02 14:14:08 +00:00
|
|
|
bool _clear_carets_and_selection();
|
2020-12-07 11:32:00 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
protected:
|
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2024-01-22 23:27:19 +00:00
|
|
|
#ifndef DISABLE_DEPRECATED
|
|
|
|
void _set_selection_mode_compat_86978(SelectionMode p_mode, int p_line = -1, int p_column = -1, int p_caret = 0);
|
|
|
|
static void _bind_compatibility_methods();
|
|
|
|
#endif // DISABLE_DEPRECATED
|
|
|
|
|
2023-04-03 16:01:10 +00:00
|
|
|
virtual void _update_theme_item_cache() override;
|
|
|
|
|
2021-07-09 12:07:10 +00:00
|
|
|
/* Internal API for CodeEdit, pending public API. */
|
2023-09-12 13:01:42 +00:00
|
|
|
// Brace matching.
|
2022-06-03 16:47:37 +00:00
|
|
|
struct BraceMatchingData {
|
|
|
|
int open_match_line = -1;
|
|
|
|
int open_match_column = -1;
|
|
|
|
bool open_matching = false;
|
|
|
|
bool open_mismatch = false;
|
|
|
|
int close_match_line = -1;
|
|
|
|
int close_match_column = -1;
|
|
|
|
bool close_matching = false;
|
|
|
|
bool close_mismatch = false;
|
|
|
|
};
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
bool highlight_matching_braces_enabled = false;
|
|
|
|
|
2021-07-09 12:07:10 +00:00
|
|
|
// Line hiding.
|
|
|
|
bool hiding_enabled = false;
|
|
|
|
|
|
|
|
void _set_hiding_enabled(bool p_enabled);
|
|
|
|
bool _is_hiding_enabled() const;
|
|
|
|
|
|
|
|
void _set_line_as_hidden(int p_line, bool p_hidden);
|
|
|
|
bool _is_line_hidden(int p_line) const;
|
|
|
|
|
|
|
|
void _unhide_all_lines();
|
2024-01-22 23:26:16 +00:00
|
|
|
virtual void _unhide_carets();
|
2021-07-09 12:07:10 +00:00
|
|
|
|
|
|
|
// Symbol lookup.
|
|
|
|
String lookup_symbol_word;
|
2021-07-01 16:10:54 +00:00
|
|
|
void _set_symbol_lookup_word(const String &p_symbol);
|
|
|
|
|
2023-09-12 13:01:42 +00:00
|
|
|
// Theme items.
|
|
|
|
virtual Color _get_brace_mismatch_color() const { return Color(); }
|
|
|
|
virtual Color _get_code_folding_color() const { return Color(); }
|
|
|
|
virtual Ref<Texture2D> _get_folded_eol_icon() const { return Ref<Texture2D>(); }
|
|
|
|
|
2021-07-08 15:48:58 +00:00
|
|
|
/* Text manipulation */
|
|
|
|
|
|
|
|
// Overridable actions
|
2022-06-03 16:47:37 +00:00
|
|
|
virtual void _handle_unicode_input_internal(const uint32_t p_unicode, int p_caret);
|
|
|
|
virtual void _backspace_internal(int p_caret);
|
2021-08-22 01:52:44 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
virtual void _cut_internal(int p_caret);
|
|
|
|
virtual void _copy_internal(int p_caret);
|
|
|
|
virtual void _paste_internal(int p_caret);
|
|
|
|
virtual void _paste_primary_clipboard_internal(int p_caret);
|
2021-08-22 01:52:44 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
GDVIRTUAL2(_handle_unicode_input, int, int)
|
|
|
|
GDVIRTUAL1(_backspace, int)
|
|
|
|
GDVIRTUAL1(_cut, int)
|
|
|
|
GDVIRTUAL1(_copy, int)
|
|
|
|
GDVIRTUAL1(_paste, int)
|
|
|
|
GDVIRTUAL1(_paste_primary_clipboard, int)
|
2021-07-08 15:48:58 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
public:
|
2021-07-10 10:41:38 +00:00
|
|
|
/* General overrides. */
|
2022-01-11 13:59:52 +00:00
|
|
|
virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;
|
2021-07-05 17:21:13 +00:00
|
|
|
virtual void gui_input(const Ref<InputEvent> &p_gui_input) override;
|
2021-11-29 14:24:02 +00:00
|
|
|
bool alt_input(const Ref<InputEvent> &p_gui_input);
|
2021-07-10 10:41:38 +00:00
|
|
|
virtual Size2 get_minimum_size() const override;
|
|
|
|
virtual bool is_text_field() const override;
|
|
|
|
virtual CursorShape get_cursor_shape(const Point2 &p_pos = Point2i()) const override;
|
2021-11-24 21:22:40 +00:00
|
|
|
virtual Variant get_drag_data(const Point2 &p_point) override;
|
|
|
|
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const override;
|
|
|
|
virtual void drop_data(const Point2 &p_point, const Variant &p_data) override;
|
2021-07-10 10:41:38 +00:00
|
|
|
virtual String get_tooltip(const Point2 &p_pos) const override;
|
2021-11-07 17:26:15 +00:00
|
|
|
void set_tooltip_request_func(const Callable &p_tooltip_callback);
|
2021-07-10 10:41:38 +00:00
|
|
|
|
|
|
|
/* Text */
|
|
|
|
// Text properties.
|
|
|
|
bool has_ime_text() const;
|
2024-01-22 17:34:12 +00:00
|
|
|
void cancel_ime();
|
|
|
|
void apply_ime();
|
2021-07-10 10:41:38 +00:00
|
|
|
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_editable(bool p_editable);
|
2021-07-09 13:05:52 +00:00
|
|
|
bool is_editable() const;
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
void set_text_direction(TextDirection p_text_direction);
|
|
|
|
TextDirection get_text_direction() const;
|
|
|
|
|
|
|
|
void set_language(const String &p_language);
|
|
|
|
String get_language() const;
|
|
|
|
|
2022-04-19 10:27:18 +00:00
|
|
|
void set_structured_text_bidi_override(TextServer::StructuredTextParser p_parser);
|
|
|
|
TextServer::StructuredTextParser get_structured_text_bidi_override() const;
|
2021-07-10 10:41:38 +00:00
|
|
|
void set_structured_text_bidi_override_options(Array p_args);
|
|
|
|
Array get_structured_text_bidi_override_options() const;
|
|
|
|
|
|
|
|
void set_tab_size(const int p_size);
|
|
|
|
int get_tab_size() const;
|
|
|
|
|
2024-02-19 11:41:12 +00:00
|
|
|
void set_indent_wrapped_lines(bool p_enabled);
|
|
|
|
bool is_indent_wrapped_lines() const;
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
// User controls
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_overtype_mode_enabled(bool p_enabled);
|
2021-07-09 12:40:05 +00:00
|
|
|
bool is_overtype_mode_enabled() const;
|
2021-07-08 15:48:58 +00:00
|
|
|
|
2021-10-08 21:26:13 +00:00
|
|
|
void set_context_menu_enabled(bool p_enabled);
|
2021-07-10 10:41:38 +00:00
|
|
|
bool is_context_menu_enabled() const;
|
|
|
|
|
|
|
|
void set_shortcut_keys_enabled(bool p_enabled);
|
|
|
|
bool is_shortcut_keys_enabled() const;
|
|
|
|
|
2021-10-08 21:26:13 +00:00
|
|
|
void set_virtual_keyboard_enabled(bool p_enabled);
|
2021-07-10 10:41:38 +00:00
|
|
|
bool is_virtual_keyboard_enabled() const;
|
|
|
|
|
2021-10-12 07:43:50 +00:00
|
|
|
void set_middle_mouse_paste_enabled(bool p_enabled);
|
|
|
|
bool is_middle_mouse_paste_enabled() const;
|
|
|
|
|
2024-04-16 09:34:01 +00:00
|
|
|
void set_empty_selection_clipboard_enabled(bool p_enabled);
|
|
|
|
bool is_empty_selection_clipboard_enabled() const;
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
// Text manipulation
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
void set_text(const String &p_text);
|
|
|
|
String get_text() const;
|
2022-05-09 09:47:10 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
int get_line_count() const;
|
|
|
|
|
2022-01-23 20:07:35 +00:00
|
|
|
void set_placeholder(const String &p_text);
|
|
|
|
String get_placeholder() const;
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
void set_line(int p_line, const String &p_new_text);
|
|
|
|
String get_line(int p_line) const;
|
|
|
|
|
|
|
|
int get_line_width(int p_line, int p_wrap_index = -1) const;
|
|
|
|
int get_line_height() const;
|
|
|
|
|
|
|
|
int get_indent_level(int p_line) const;
|
|
|
|
int get_first_non_whitespace_column(int p_line) const;
|
|
|
|
|
|
|
|
void swap_lines(int p_from_line, int p_to_line);
|
|
|
|
|
2024-01-22 23:27:19 +00:00
|
|
|
void insert_line_at(int p_line, const String &p_text);
|
|
|
|
void remove_line_at(int p_line, bool p_move_carets_down = true);
|
2021-07-10 10:41:38 +00:00
|
|
|
|
2024-01-22 23:27:19 +00:00
|
|
|
void insert_text_at_caret(const String &p_text, int p_caret = -1);
|
|
|
|
void insert_text(const String &p_text, int p_line, int p_column, bool p_before_selection_begin = true, bool p_before_selection_end = false);
|
2021-07-10 10:41:38 +00:00
|
|
|
void remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column);
|
|
|
|
|
|
|
|
int get_last_unhidden_line() const;
|
|
|
|
int get_next_visible_line_offset_from(int p_line_from, int p_visible_amount) const;
|
|
|
|
Point2i get_next_visible_line_index_offset_from(int p_line_from, int p_wrap_index_from, int p_visible_amount) const;
|
|
|
|
|
2021-07-08 15:48:58 +00:00
|
|
|
// Overridable actions
|
2022-06-03 16:47:37 +00:00
|
|
|
void handle_unicode_input(const uint32_t p_unicode, int p_caret = -1);
|
|
|
|
void backspace(int p_caret = -1);
|
2021-07-08 15:48:58 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
void cut(int p_caret = -1);
|
|
|
|
void copy(int p_caret = -1);
|
|
|
|
void paste(int p_caret = -1);
|
|
|
|
void paste_primary_clipboard(int p_caret = -1);
|
2021-07-08 15:48:58 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
// Context menu.
|
|
|
|
PopupMenu *get_menu() const;
|
|
|
|
bool is_menu_visible() const;
|
|
|
|
void menu_option(int p_option);
|
|
|
|
|
|
|
|
/* Versioning */
|
2022-06-03 16:47:37 +00:00
|
|
|
void start_action(EditAction p_action);
|
|
|
|
void end_action();
|
|
|
|
EditAction get_current_action() const;
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
void begin_complex_operation();
|
|
|
|
void end_complex_operation();
|
|
|
|
|
2021-08-17 03:41:46 +00:00
|
|
|
bool has_undo() const;
|
|
|
|
bool has_redo() const;
|
2021-07-10 10:41:38 +00:00
|
|
|
void undo();
|
|
|
|
void redo();
|
|
|
|
void clear_undo_history();
|
|
|
|
|
|
|
|
bool is_insert_text_operation() const;
|
|
|
|
|
|
|
|
void tag_saved_version();
|
|
|
|
|
|
|
|
uint32_t get_version() const;
|
|
|
|
uint32_t get_saved_version() const;
|
|
|
|
|
|
|
|
/* Search */
|
|
|
|
void set_search_text(const String &p_search_text);
|
|
|
|
void set_search_flags(uint32_t p_flags);
|
|
|
|
|
|
|
|
Point2i search(const String &p_key, uint32_t p_search_flags, int p_from_line, int p_from_column) const;
|
|
|
|
|
|
|
|
/* Mouse */
|
|
|
|
Point2 get_local_mouse_pos() const;
|
|
|
|
|
|
|
|
String get_word_at_pos(const Vector2 &p_pos) const;
|
|
|
|
|
2021-10-31 18:34:54 +00:00
|
|
|
Point2i get_line_column_at_pos(const Point2i &p_pos, bool p_allow_out_of_bounds = true) const;
|
2021-11-18 15:55:43 +00:00
|
|
|
Point2i get_pos_at_line_column(int p_line, int p_column) const;
|
|
|
|
Rect2i get_rect_at_line_column(int p_line, int p_column) const;
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
int get_minimap_line_at_pos(const Point2i &p_pos) const;
|
|
|
|
|
|
|
|
bool is_dragging_cursor() const;
|
2022-06-03 16:47:37 +00:00
|
|
|
bool is_mouse_over_selection(bool p_edges = true, int p_caret = -1) const;
|
2021-07-10 10:41:38 +00:00
|
|
|
|
2021-07-08 17:35:56 +00:00
|
|
|
/* Caret */
|
|
|
|
void set_caret_type(CaretType p_type);
|
|
|
|
CaretType get_caret_type() const;
|
|
|
|
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_caret_blink_enabled(bool p_enabled);
|
2021-07-08 17:35:56 +00:00
|
|
|
bool is_caret_blink_enabled() const;
|
|
|
|
|
2022-08-13 12:52:35 +00:00
|
|
|
void set_caret_blink_interval(const float p_interval);
|
|
|
|
float get_caret_blink_interval() const;
|
2021-07-08 17:35:56 +00:00
|
|
|
|
2023-02-07 23:02:48 +00:00
|
|
|
void set_draw_caret_when_editable_disabled(bool p_enable);
|
|
|
|
bool is_drawing_caret_when_editable_disabled() const;
|
|
|
|
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_move_caret_on_right_click_enabled(bool p_enabled);
|
2021-07-08 17:35:56 +00:00
|
|
|
bool is_move_caret_on_right_click_enabled() const;
|
|
|
|
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_caret_mid_grapheme_enabled(bool p_enabled);
|
2021-07-08 17:35:56 +00:00
|
|
|
bool is_caret_mid_grapheme_enabled() const;
|
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
void set_multiple_carets_enabled(bool p_enabled);
|
|
|
|
bool is_multiple_carets_enabled() const;
|
|
|
|
|
2024-01-22 23:26:16 +00:00
|
|
|
int add_caret(int p_line, int p_column);
|
2022-06-03 16:47:37 +00:00
|
|
|
void remove_caret(int p_caret);
|
2024-07-04 23:29:15 +00:00
|
|
|
void remove_drag_caret();
|
2022-06-03 16:47:37 +00:00
|
|
|
void remove_secondary_carets();
|
|
|
|
int get_caret_count() const;
|
2022-10-09 15:07:42 +00:00
|
|
|
void add_caret_at_carets(bool p_below);
|
2022-06-03 16:47:37 +00:00
|
|
|
|
2024-01-22 23:27:19 +00:00
|
|
|
Vector<int> get_sorted_carets(bool p_include_ignored_carets = false) const;
|
|
|
|
void collapse_carets(int p_from_line, int p_from_column, int p_to_line, int p_to_column, bool p_inclusive = false);
|
|
|
|
|
|
|
|
void merge_overlapping_carets();
|
|
|
|
void begin_multicaret_edit();
|
|
|
|
void end_multicaret_edit();
|
|
|
|
bool is_in_mulitcaret_edit() const;
|
|
|
|
bool multicaret_edit_ignore_caret(int p_caret) const;
|
2022-06-03 16:47:37 +00:00
|
|
|
|
|
|
|
bool is_caret_visible(int p_caret = 0) const;
|
|
|
|
Point2 get_caret_draw_pos(int p_caret = 0) const;
|
2021-07-08 17:35:56 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
void set_caret_line(int p_line, bool p_adjust_viewport = true, bool p_can_be_hidden = true, int p_wrap_index = 0, int p_caret = 0);
|
|
|
|
int get_caret_line(int p_caret = 0) const;
|
2021-07-08 17:35:56 +00:00
|
|
|
|
2024-01-22 23:27:19 +00:00
|
|
|
void set_caret_column(int p_column, bool p_adjust_viewport = true, int p_caret = 0);
|
2022-06-03 16:47:37 +00:00
|
|
|
int get_caret_column(int p_caret = 0) const;
|
2021-07-08 17:35:56 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
int get_caret_wrap_index(int p_caret = 0) const;
|
2021-07-08 17:35:56 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
String get_word_under_caret(int p_caret = -1) const;
|
2021-07-10 10:41:38 +00:00
|
|
|
|
2021-07-09 11:42:55 +00:00
|
|
|
/* Selection. */
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_selecting_enabled(bool p_enabled);
|
2021-07-09 11:42:55 +00:00
|
|
|
bool is_selecting_enabled() const;
|
|
|
|
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_deselect_on_focus_loss_enabled(bool p_enabled);
|
2021-10-21 21:02:46 +00:00
|
|
|
bool is_deselect_on_focus_loss_enabled() const;
|
|
|
|
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_drag_and_drop_selection_enabled(bool p_enabled);
|
2022-06-19 14:55:13 +00:00
|
|
|
bool is_drag_and_drop_selection_enabled() const;
|
|
|
|
|
2024-01-22 23:26:16 +00:00
|
|
|
void set_selection_mode(SelectionMode p_mode);
|
2021-07-09 11:42:55 +00:00
|
|
|
SelectionMode get_selection_mode() const;
|
|
|
|
|
|
|
|
void select_all();
|
2022-06-03 16:47:37 +00:00
|
|
|
void select_word_under_caret(int p_caret = -1);
|
2022-10-19 17:35:14 +00:00
|
|
|
void add_selection_for_next_occurrence();
|
2024-02-02 22:10:55 +00:00
|
|
|
void skip_selection_for_next_occurrence();
|
2024-01-22 23:26:16 +00:00
|
|
|
void select(int p_origin_line, int p_origin_column, int p_caret_line, int p_caret_column, int p_caret = 0);
|
2021-07-09 11:42:55 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
bool has_selection(int p_caret = -1) const;
|
2021-07-09 11:42:55 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
String get_selected_text(int p_caret = -1);
|
2024-01-22 23:27:19 +00:00
|
|
|
int get_selection_at_line_column(int p_line, int p_column, bool p_include_edges = true, bool p_only_selections = true) const;
|
2024-01-22 23:26:16 +00:00
|
|
|
Vector<Point2i> get_line_ranges_from_carets(bool p_only_selections = false, bool p_merge_adjacent = true) const;
|
|
|
|
TypedArray<Vector2i> get_line_ranges_from_carets_typed_array(bool p_only_selections = false, bool p_merge_adjacent = true) const;
|
2021-07-09 11:42:55 +00:00
|
|
|
|
2024-01-22 23:26:16 +00:00
|
|
|
void set_selection_origin_line(int p_line, bool p_can_be_hidden = true, int p_wrap_index = -1, int p_caret = 0);
|
|
|
|
void set_selection_origin_column(int p_column, int p_caret = 0);
|
|
|
|
int get_selection_origin_line(int p_caret = 0) const;
|
|
|
|
int get_selection_origin_column(int p_caret = 0) const;
|
2021-07-09 11:42:55 +00:00
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
int get_selection_from_line(int p_caret = 0) const;
|
|
|
|
int get_selection_from_column(int p_caret = 0) const;
|
|
|
|
int get_selection_to_line(int p_caret = 0) const;
|
|
|
|
int get_selection_to_column(int p_caret = 0) const;
|
2021-07-09 11:42:55 +00:00
|
|
|
|
2024-01-22 23:26:16 +00:00
|
|
|
bool is_caret_after_selection_origin(int p_caret = 0) const;
|
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
void deselect(int p_caret = -1);
|
|
|
|
void delete_selection(int p_caret = -1);
|
2021-07-09 11:42:55 +00:00
|
|
|
|
2021-11-18 15:55:43 +00:00
|
|
|
/* Line wrapping. */
|
2021-07-09 10:52:49 +00:00
|
|
|
void set_line_wrapping_mode(LineWrappingMode p_wrapping_mode);
|
|
|
|
LineWrappingMode get_line_wrapping_mode() const;
|
|
|
|
|
2023-03-12 11:21:00 +00:00
|
|
|
void set_autowrap_mode(TextServer::AutowrapMode p_mode);
|
|
|
|
TextServer::AutowrapMode get_autowrap_mode() const;
|
|
|
|
|
2021-07-09 10:52:49 +00:00
|
|
|
bool is_line_wrapped(int p_line) const;
|
|
|
|
int get_line_wrap_count(int p_line) const;
|
|
|
|
int get_line_wrap_index_at_column(int p_line, int p_column) const;
|
|
|
|
|
|
|
|
Vector<String> get_line_wrapped_text(int p_line) const;
|
|
|
|
|
2021-07-09 16:27:09 +00:00
|
|
|
/* Viewport. */
|
2021-07-10 10:41:38 +00:00
|
|
|
// Scrolling.
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_smooth_scroll_enabled(bool p_enabled);
|
2021-07-09 16:27:09 +00:00
|
|
|
bool is_smooth_scroll_enabled() const;
|
|
|
|
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_scroll_past_end_of_file_enabled(bool p_enabled);
|
2021-07-09 16:27:09 +00:00
|
|
|
bool is_scroll_past_end_of_file_enabled() const;
|
|
|
|
|
2022-09-28 04:55:06 +00:00
|
|
|
VScrollBar *get_v_scroll_bar() const;
|
|
|
|
HScrollBar *get_h_scroll_bar() const;
|
|
|
|
|
2021-07-09 16:27:09 +00:00
|
|
|
void set_v_scroll(double p_scroll);
|
|
|
|
double get_v_scroll() const;
|
|
|
|
|
|
|
|
void set_h_scroll(int p_scroll);
|
|
|
|
int get_h_scroll() const;
|
|
|
|
|
|
|
|
void set_v_scroll_speed(float p_speed);
|
|
|
|
float get_v_scroll_speed() const;
|
|
|
|
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_fit_content_height_enabled(bool p_enabled);
|
2022-06-20 23:19:54 +00:00
|
|
|
bool is_fit_content_height_enabled() const;
|
|
|
|
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_fit_content_width_enabled(bool p_enabled);
|
|
|
|
bool is_fit_content_width_enabled() const;
|
|
|
|
|
2021-07-09 16:27:09 +00:00
|
|
|
double get_scroll_pos_for_line(int p_line, int p_wrap_index = 0) const;
|
|
|
|
|
|
|
|
// Visible lines.
|
|
|
|
void set_line_as_first_visible(int p_line, int p_wrap_index = 0);
|
|
|
|
int get_first_visible_line() const;
|
|
|
|
|
|
|
|
void set_line_as_center_visible(int p_line, int p_wrap_index = 0);
|
|
|
|
|
|
|
|
void set_line_as_last_visible(int p_line, int p_wrap_index = 0);
|
|
|
|
int get_last_full_visible_line() const;
|
|
|
|
int get_last_full_visible_line_wrap_index() const;
|
|
|
|
|
|
|
|
int get_visible_line_count() const;
|
2021-10-31 18:34:54 +00:00
|
|
|
int get_visible_line_count_in_range(int p_from, int p_to) const;
|
2021-07-09 16:27:09 +00:00
|
|
|
int get_total_visible_line_count() const;
|
|
|
|
|
|
|
|
// Auto Adjust
|
2022-06-03 16:47:37 +00:00
|
|
|
void adjust_viewport_to_caret(int p_caret = 0);
|
|
|
|
void center_viewport_to_caret(int p_caret = 0);
|
2021-07-09 16:27:09 +00:00
|
|
|
|
|
|
|
// Minimap
|
2021-10-08 21:26:13 +00:00
|
|
|
void set_draw_minimap(bool p_enabled);
|
2021-07-09 16:27:09 +00:00
|
|
|
bool is_drawing_minimap() const;
|
|
|
|
|
|
|
|
void set_minimap_width(int p_minimap_width);
|
|
|
|
int get_minimap_width() const;
|
|
|
|
|
|
|
|
int get_minimap_visible_lines() const;
|
|
|
|
|
2020-07-25 00:15:23 +00:00
|
|
|
/* Gutters. */
|
|
|
|
void add_gutter(int p_at = -1);
|
|
|
|
void remove_gutter(int p_gutter);
|
|
|
|
int get_gutter_count() const;
|
2024-08-12 01:58:26 +00:00
|
|
|
Vector2i get_hovered_gutter() const { return hovered_gutter; }
|
2020-07-25 00:15:23 +00:00
|
|
|
|
|
|
|
void set_gutter_name(int p_gutter, const String &p_name);
|
|
|
|
String get_gutter_name(int p_gutter) const;
|
|
|
|
|
|
|
|
void set_gutter_type(int p_gutter, GutterType p_type);
|
|
|
|
GutterType get_gutter_type(int p_gutter) const;
|
|
|
|
|
|
|
|
void set_gutter_width(int p_gutter, int p_width);
|
|
|
|
int get_gutter_width(int p_gutter) const;
|
2021-03-13 14:09:49 +00:00
|
|
|
int get_total_gutter_width() const;
|
2020-07-25 00:15:23 +00:00
|
|
|
|
|
|
|
void set_gutter_draw(int p_gutter, bool p_draw);
|
|
|
|
bool is_gutter_drawn(int p_gutter) const;
|
|
|
|
|
|
|
|
void set_gutter_clickable(int p_gutter, bool p_clickable);
|
|
|
|
bool is_gutter_clickable(int p_gutter) const;
|
|
|
|
|
|
|
|
void set_gutter_overwritable(int p_gutter, bool p_overwritable);
|
|
|
|
bool is_gutter_overwritable(int p_gutter) const;
|
|
|
|
|
2021-06-15 14:05:01 +00:00
|
|
|
void merge_gutters(int p_from_line, int p_to_line);
|
|
|
|
|
2021-11-07 17:26:15 +00:00
|
|
|
void set_gutter_custom_draw(int p_gutter, const Callable &p_draw_callback);
|
2020-07-25 00:15:23 +00:00
|
|
|
|
|
|
|
// Line gutters.
|
|
|
|
void set_line_gutter_metadata(int p_line, int p_gutter, const Variant &p_metadata);
|
|
|
|
Variant get_line_gutter_metadata(int p_line, int p_gutter) const;
|
|
|
|
|
|
|
|
void set_line_gutter_text(int p_line, int p_gutter, const String &p_text);
|
|
|
|
String get_line_gutter_text(int p_line, int p_gutter) const;
|
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
void set_line_gutter_icon(int p_line, int p_gutter, const Ref<Texture2D> &p_icon);
|
2020-07-25 00:15:23 +00:00
|
|
|
Ref<Texture2D> get_line_gutter_icon(int p_line, int p_gutter) const;
|
|
|
|
|
|
|
|
void set_line_gutter_item_color(int p_line, int p_gutter, const Color &p_color);
|
2021-07-10 10:41:38 +00:00
|
|
|
Color get_line_gutter_item_color(int p_line, int p_gutter) const;
|
2020-07-25 00:15:23 +00:00
|
|
|
|
|
|
|
void set_line_gutter_clickable(int p_line, int p_gutter, bool p_clickable);
|
|
|
|
bool is_line_gutter_clickable(int p_line, int p_gutter) const;
|
|
|
|
|
2020-09-10 20:25:00 +00:00
|
|
|
// Line style
|
|
|
|
void set_line_background_color(int p_line, const Color &p_color);
|
2021-07-10 10:41:38 +00:00
|
|
|
Color get_line_background_color(int p_line) const;
|
2020-09-10 20:25:00 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
/* Syntax Highlighting. */
|
|
|
|
void set_syntax_highlighter(Ref<SyntaxHighlighter> p_syntax_highlighter);
|
|
|
|
Ref<SyntaxHighlighter> get_syntax_highlighter() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-07-10 10:41:38 +00:00
|
|
|
/* Visual. */
|
|
|
|
void set_highlight_current_line(bool p_enabled);
|
|
|
|
bool is_highlight_current_line_enabled() const;
|
2016-05-28 16:25:45 +00:00
|
|
|
|
2024-03-17 23:19:17 +00:00
|
|
|
void set_highlight_all_occurrences(bool p_enabled);
|
2016-07-11 14:20:01 +00:00
|
|
|
bool is_highlight_all_occurrences_enabled() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-10-08 21:26:13 +00:00
|
|
|
void set_draw_control_chars(bool p_enabled);
|
2021-07-10 10:41:38 +00:00
|
|
|
bool get_draw_control_chars() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-10-08 21:26:13 +00:00
|
|
|
void set_draw_tabs(bool p_enabled);
|
2014-02-10 01:10:30 +00:00
|
|
|
bool is_drawing_tabs() const;
|
2021-07-10 10:41:38 +00:00
|
|
|
|
2021-10-08 21:26:13 +00:00
|
|
|
void set_draw_spaces(bool p_enabled);
|
2019-04-23 23:33:20 +00:00
|
|
|
bool is_drawing_spaces() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2023-09-19 12:36:38 +00:00
|
|
|
Color get_font_color() const;
|
|
|
|
|
2024-05-29 11:06:43 +00:00
|
|
|
/* Behavior */
|
|
|
|
|
|
|
|
String get_default_word_separators() const;
|
|
|
|
|
|
|
|
void set_use_default_word_separators(bool p_enabled);
|
|
|
|
bool is_default_word_separators_enabled() const;
|
|
|
|
|
|
|
|
void set_custom_word_separators(const String &p_separators);
|
|
|
|
void set_use_custom_word_separators(bool p_enabled);
|
|
|
|
bool is_custom_word_separators_enabled() const;
|
|
|
|
|
|
|
|
String get_custom_word_separators() const;
|
|
|
|
|
2024-01-22 23:27:19 +00:00
|
|
|
/* Deprecated. */
|
|
|
|
#ifndef DISABLE_DEPRECATED
|
|
|
|
Vector<int> get_caret_index_edit_order();
|
|
|
|
void adjust_carets_after_edit(int p_caret, int p_from_line, int p_from_col, int p_to_line, int p_to_col);
|
|
|
|
|
|
|
|
int get_selection_line(int p_caret = 0) const;
|
|
|
|
int get_selection_column(int p_caret = 0) const;
|
|
|
|
#endif
|
|
|
|
|
2022-03-04 08:18:44 +00:00
|
|
|
TextEdit(const String &p_placeholder = String());
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
2022-06-03 16:47:37 +00:00
|
|
|
VARIANT_ENUM_CAST(TextEdit::EditAction);
|
2021-07-08 17:35:56 +00:00
|
|
|
VARIANT_ENUM_CAST(TextEdit::CaretType);
|
2021-07-09 10:52:49 +00:00
|
|
|
VARIANT_ENUM_CAST(TextEdit::LineWrappingMode);
|
2020-10-11 17:44:53 +00:00
|
|
|
VARIANT_ENUM_CAST(TextEdit::SelectionMode);
|
2021-07-08 17:35:56 +00:00
|
|
|
VARIANT_ENUM_CAST(TextEdit::GutterType);
|
2017-08-20 15:45:01 +00:00
|
|
|
VARIANT_ENUM_CAST(TextEdit::MenuItems);
|
|
|
|
VARIANT_ENUM_CAST(TextEdit::SearchFlags);
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
#endif // TEXT_EDIT_H
|