Skip to content

Commit

Permalink
C#: Fix line in OpenInExternalEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
raulsntos committed Jul 17, 2023
1 parent 83cc5d4 commit 132a1da
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion editor/editor_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions editor/plugins/script_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ private void IssueActivated(long idx)
{
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();
}
}
Expand Down

0 comments on commit 132a1da

Please sign in to comment.