diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2020-05-16 23:23:46 +0200 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2020-05-16 23:46:14 +0200 |
commit | 242b94af1aa87d9c255a7cb1747049fc1da107e5 (patch) | |
tree | aa89db4732114658ae9e610a1d7bd496e5706413 /scene | |
parent | 163687d17a8a11da3cf1a3595c511a5f8fc94571 (diff) |
TextEdit search returns a dictionary instead of Vector
Easier to use than accessing elements in a Vector using indices given by an enum.
Breaks compatibility on existing scripts using this functionality.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/text_edit.cpp | 14 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 8 |
2 files changed, 6 insertions, 16 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 932dda2f9d..e050b3f174 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -5447,17 +5447,16 @@ int TextEdit::_get_column_pos_of_word(const String &p_key, const String &p_searc return col; } -Vector<int> TextEdit::_search_bind(const String &p_key, uint32_t p_search_flags, int p_from_line, int p_from_column) const { +Dictionary TextEdit::_search_bind(const String &p_key, uint32_t p_search_flags, int p_from_line, int p_from_column) const { int col, line; if (search(p_key, p_search_flags, p_from_line, p_from_column, line, col)) { - Vector<int> result; - result.resize(2); - result.set(SEARCH_RESULT_COLUMN, col); - result.set(SEARCH_RESULT_LINE, line); + Dictionary result; + result["line"] = line; + result["column"] = col; return result; } else { - return Vector<int>(); + return Dictionary(); } } @@ -6980,9 +6979,6 @@ void TextEdit::_bind_methods() { BIND_ENUM_CONSTANT(SEARCH_WHOLE_WORDS); BIND_ENUM_CONSTANT(SEARCH_BACKWARDS); - BIND_ENUM_CONSTANT(SEARCH_RESULT_COLUMN); - BIND_ENUM_CONSTANT(SEARCH_RESULT_LINE); - /* ClassDB::bind_method(D_METHOD("delete_char"),&TextEdit::delete_char); ClassDB::bind_method(D_METHOD("delete_line"),&TextEdit::delete_line); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 689199b6c2..ab78f77d94 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -508,7 +508,7 @@ private: int _get_column_pos_of_word(const String &p_key, const String &p_search, uint32_t p_search_flags, int p_from_column); - Vector<int> _search_bind(const String &p_key, uint32_t p_search_flags, int p_from_line, int p_from_column) const; + Dictionary _search_bind(const String &p_key, uint32_t p_search_flags, int p_from_line, int p_from_column) const; PopupMenu *menu; @@ -561,11 +561,6 @@ public: SEARCH_BACKWARDS = 4 }; - enum SearchResult { - SEARCH_RESULT_COLUMN, - SEARCH_RESULT_LINE, - }; - virtual CursorShape get_cursor_shape(const Point2 &p_pos = Point2i()) const; void _get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) const; @@ -826,7 +821,6 @@ public: VARIANT_ENUM_CAST(TextEdit::MenuItems); VARIANT_ENUM_CAST(TextEdit::SearchFlags); -VARIANT_ENUM_CAST(TextEdit::SearchResult); class SyntaxHighlighter { protected: |