Fixes ctrl-click function line centering

When ctrl-clicking in the code editor, the view will now be centered on the function result.

Also replaces a circumstance where goto_line_centered should be used.
This commit is contained in:
Kyle 2021-03-24 12:29:14 -04:00
parent 1829eb4608
commit 2b775bd698

View file

@ -601,8 +601,7 @@ void ScriptTextEditor::_bookmark_item_pressed(int p_idx) {
if (p_idx < 4) { // Any item before the separator. if (p_idx < 4) { // Any item before the separator.
_edit_option(bookmarks_menu->get_item_id(p_idx)); _edit_option(bookmarks_menu->get_item_id(p_idx));
} else { } else {
code_editor->goto_line(bookmarks_menu->get_item_metadata(p_idx)); code_editor->goto_line_centered(bookmarks_menu->get_item_metadata(p_idx));
code_editor->get_text_editor()->call_deferred("center_viewport_to_cursor"); //Need to be deferred, because goto uses call_deferred().
} }
} }
@ -791,7 +790,7 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
emit_signal("request_open_script_at_line", result.script, result.location - 1); emit_signal("request_open_script_at_line", result.script, result.location - 1);
} else { } else {
emit_signal("request_save_history"); emit_signal("request_save_history");
_goto_line(result.location - 1); goto_line_centered(result.location - 1);
} }
} break; } break;
case ScriptLanguage::LookupResult::RESULT_CLASS: { case ScriptLanguage::LookupResult::RESULT_CLASS: {