summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaul Santos <raulsntos@gmail.com>2023-07-13 02:52:09 +0200
committerRaul Santos <raulsntos@gmail.com>2023-07-17 18:44:17 +0200
commit132a1daf1a7eac623829bd1d149f79ac95853c9a (patch)
tree01952cc3ba443cc04fbf77665259ec6cab963332
parent83cc5d4914a6bff76069ac19191192337e4df3de (diff)
downloadredot-engine-132a1daf1a7eac623829bd1d149f79ac95853c9a.tar.gz
C#: Fix line in OpenInExternalEditor
-rw-r--r--editor/editor_interface.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp6
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs3
3 files changed, 6 insertions, 5 deletions
diff --git a/editor/editor_interface.cpp b/editor/editor_interface.cpp
index d9d9dc01c0..8b2a51d4d2 100644
--- a/editor/editor_interface.cpp
+++ b/editor/editor_interface.cpp
@@ -280,7 +280,7 @@ void EditorInterface::edit_node(Node *p_node) {
}
void EditorInterface::edit_script(const Ref<Script> &p_script, int p_line, int p_col, bool p_grab_focus) {
- ScriptEditor::get_singleton()->edit(p_script, p_line, p_col, p_grab_focus);
+ ScriptEditor::get_singleton()->edit(p_script, p_line - 1, p_col - 1, p_grab_focus);
}
void EditorInterface::open_scene_from_path(const String &scene_path) {
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 1d449d79a6..ee1bf94e8c 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -2331,7 +2331,7 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col,
}
if (p_line > 0) {
- se->goto_line(p_line - 1);
+ se->goto_line(p_line);
}
}
_update_script_names();
@@ -2426,8 +2426,8 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col,
_test_script_times_on_disk(p_resource);
_update_modified_scripts_for_external_editor(p_resource);
- if (p_line > 0) {
- se->goto_line(p_line - 1);
+ if (p_line >= 0) {
+ se->goto_line(p_line);
}
notify_script_changed(p_resource);
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
index c083b9cc60..54f7ed02f5 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
@@ -138,7 +138,8 @@ namespace GodotTools.Build
{
var script = (Script)ResourceLoader.Load(file, typeHint: Internal.CSharpLanguageType);
- if (script != null && Internal.ScriptEditorEdit(script, issue.Line, issue.Column))
+ // Godot's ScriptEditor.Edit is 0-based but the issue lines are 1-based.
+ if (script != null && Internal.ScriptEditorEdit(script, issue.Line - 1, issue.Column - 1))
Internal.EditorNodeShowScriptScreen();
}
}