You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Limit error messages in CodeTextEditor to 2 lines length
This commit is contained in:
@@ -1501,7 +1501,15 @@ Variant CodeTextEditor::get_navigation_state() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CodeTextEditor::set_error(const String &p_error) {
|
void CodeTextEditor::set_error(const String &p_error) {
|
||||||
error->set_text(p_error);
|
// Trim the error message if it is more than 2 lines long.
|
||||||
|
if (p_error.count("\n") >= 2) {
|
||||||
|
Vector<String> splits = p_error.split("\n");
|
||||||
|
String trimmed_error = String("\n").join(splits.slice(0, 2));
|
||||||
|
error->set_text(trimmed_error + "...");
|
||||||
|
} else {
|
||||||
|
error->set_text(p_error);
|
||||||
|
}
|
||||||
|
|
||||||
if (!p_error.is_empty()) {
|
if (!p_error.is_empty()) {
|
||||||
error->set_default_cursor_shape(CURSOR_POINTING_HAND);
|
error->set_default_cursor_shape(CURSOR_POINTING_HAND);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user