1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

CodeEditor: Make possible to select and copy error text

This commit is contained in:
Danil Alexeev
2025-05-07 00:16:03 +03:00
committed by Rémi Verschelde
parent 03bd8ba9c2
commit db9b8ff003
7 changed files with 150 additions and 81 deletions

View File

@@ -819,10 +819,12 @@ void ScriptTextEditor::_validate_script() {
}
if (errors.size() > 0) {
// TRANSLATORS: Script error pointing to a line and column number.
String error_text = vformat(TTR("Error at (%d, %d):"), errors.front()->get().line, errors.front()->get().column) + " " + errors.front()->get().message;
const int line = errors.front()->get().line;
const int column = errors.front()->get().column;
const String message = errors.front()->get().message.replace("[", "[lb]");
const String error_text = vformat(TTR("Error at ([hint=Line %d, column %d]%d, %d[/hint]):"), line, column, line, column) + " " + message;
code_editor->set_error(error_text);
code_editor->set_error_pos(errors.front()->get().line - 1, errors.front()->get().column - 1);
code_editor->set_error_pos(line - 1, column - 1);
}
script_is_valid = false;
} else {