diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-17 18:33:48 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-17 18:33:48 +0200 |
commit | da4f6e439c0daec87d3f87f86b5b4592fca44fdb (patch) | |
tree | 88597c278713854bf0dd7bb61c86ff2fe6cdd125 /editor/plugins/script_text_editor.cpp | |
parent | 6d7ef2c33a84661f7e2387be4f86a7617d3cd36b (diff) | |
parent | 063a362755dc64c4e9e58fdb579a6151e21a399b (diff) | |
download | redot-engine-da4f6e439c0daec87d3f87f86b5b4592fca44fdb.tar.gz |
Merge pull request #94474 from dalexeev/editor-fix-jump-to-error-column
Editor: Consider tabs when calculating column for jump to error
Diffstat (limited to 'editor/plugins/script_text_editor.cpp')
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 96127ec93e..070471f3f3 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -317,7 +317,16 @@ void ScriptTextEditor::_error_clicked(const Variant &p_line) { if (!scr.is_valid()) { EditorNode::get_singleton()->show_warning(TTR("Could not load file at:") + "\n\n" + path, TTR("Error!")); } else { - ScriptEditor::get_singleton()->edit(scr, line, column); + int corrected_column = column; + + const String line_text = code_editor->get_text_editor()->get_line(line); + const int indent_size = code_editor->get_text_editor()->get_indent_size(); + if (indent_size > 1) { + const int tab_count = line_text.length() - line_text.lstrip("\t").length(); + corrected_column -= tab_count * (indent_size - 1); + } + + ScriptEditor::get_singleton()->edit(scr, line, corrected_column); } } } |