summaryrefslogtreecommitdiff
path: root/editor/debugger
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2022-08-18 16:20:20 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2022-12-16 13:18:57 +0800
commit207e52c161a44869f1af022030c3129b8c38a5f7 (patch)
tree3df831f12e9ded2b734b37d61837d2a35afbf685 /editor/debugger
parentf18f2740da9cce7383c2aa41fe8d081d56c8b6cf (diff)
Fix String::word_wrap() for long words
- Changes `TextServer.string_get_word_breaks()` - Returns pairs of boundary start and end offsets - Accepts `chars_per_line` to return line breaks - Removes `String::word_wrap()` Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
Diffstat (limited to 'editor/debugger')
-rw-r--r--editor/debugger/script_editor_debugger.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index deca638f3b..5cb7016b35 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -751,7 +751,16 @@ void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType
reason->add_theme_color_override("font_color", get_theme_color(SNAME("success_color"), SNAME("Editor")));
}
reason->set_text(p_reason);
- reason->set_tooltip_text(p_reason.word_wrap(80));
+
+ const PackedInt32Array boundaries = TS->string_get_word_breaks(p_reason, "", 80);
+ PackedStringArray lines;
+ for (int i = 0; i < boundaries.size(); i += 2) {
+ const int start = boundaries[i];
+ const int end = boundaries[i + 1];
+ lines.append(p_reason.substr(start, end - start + 1));
+ }
+
+ reason->set_tooltip_text(String("\n").join(lines));
}
void ScriptEditorDebugger::_notification(int p_what) {