summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2019-10-31 12:35:23 +0100
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2019-10-31 12:35:23 +0100
commitd29c8ab81b8b32f99e42153c7708c99a9eab3b55 (patch)
tree4d454229978dd9b346b3b2f960e5897313fbfea2 /scene/gui
parent99324d9fdac44a528d54027b8997b4cf44e5934e (diff)
Improved TextEdit search usability & documentation
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/text_edit.cpp9
-rw-r--r--scene/gui/text_edit.h7
2 files changed, 12 insertions, 4 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 8cf6099279..6d473b7939 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -5443,11 +5443,11 @@ int TextEdit::_get_column_pos_of_word(const String &p_key, const String &p_searc
PoolVector<int> 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, col, line)) {
+ if (search(p_key, p_search_flags, p_from_line, p_from_column, line, col)) {
PoolVector<int> result;
result.resize(2);
- result.set(0, line);
- result.set(1, col);
+ result.set(SEARCH_RESULT_COLUMN, col);
+ result.set(SEARCH_RESULT_LINE, line);
return result;
} else {
@@ -6960,6 +6960,9 @@ 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 e640bf0ea9..594366de7d 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -504,12 +504,16 @@ public:
};
enum SearchFlags {
-
SEARCH_MATCH_CASE = 1,
SEARCH_WHOLE_WORDS = 2,
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;
@@ -768,6 +772,7 @@ public:
VARIANT_ENUM_CAST(TextEdit::MenuItems);
VARIANT_ENUM_CAST(TextEdit::SearchFlags);
+VARIANT_ENUM_CAST(TextEdit::SearchResult);
class SyntaxHighlighter {
protected: