summaryrefslogtreecommitdiff
path: root/scene/gui/text_edit.cpp
diff options
context:
space:
mode:
authorAndreas Haas <liu.gam3@gmail.com>2017-08-02 19:20:27 +0200
committerAndreas Haas <liu.gam3@gmail.com>2017-08-02 19:23:57 +0200
commit708ddb05af51a1dcc4cc19ace67e7c4bc23d785b (patch)
tree948f8df35c0dcc11a73b4d9d30f971d2cf0c8e23 /scene/gui/text_edit.cpp
parent0586524b9ce67bdcab5cef88397c44bb7b9e46fb (diff)
ScriptEditor: ctrl+click can open scenes/resources.
Closes #9654
Diffstat (limited to 'scene/gui/text_edit.cpp')
-rw-r--r--scene/gui/text_edit.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index d604738da1..2fc3204f3a 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4353,6 +4353,23 @@ String TextEdit::get_word_at_pos(const Vector2 &p_pos) const {
bool symbol = beg < s.length() && _is_symbol(s[beg]); //not sure if right but most editors behave like this
+ bool inside_quotes = false;
+ int qbegin, qend;
+ for (int i = 0; i < s.length(); i++) {
+ if (s[i] == '"') {
+ if (inside_quotes) {
+ qend = i;
+ inside_quotes = false;
+ if (col >= qbegin && col <= qend) {
+ return s.substr(qbegin, qend - qbegin);
+ }
+ } else {
+ qbegin = i + 1;
+ inside_quotes = true;
+ }
+ }
+ }
+
while (beg > 0 && s[beg - 1] > 32 && (symbol == _is_symbol(s[beg - 1]))) {
beg--;
}