mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
Center script line when double clicked on error in debugger
This commit is contained in:
parent
4d6ad16ac4
commit
0f14489ecb
@ -1217,6 +1217,11 @@ void CodeTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
|
||||
text_editor->select(p_line, p_begin, p_line, p_end);
|
||||
}
|
||||
|
||||
void CodeTextEditor::goto_line_centered(int p_line) {
|
||||
goto_line(p_line);
|
||||
text_editor->call_deferred("center_viewport_to_cursor");
|
||||
}
|
||||
|
||||
void CodeTextEditor::set_executing_line(int p_line) {
|
||||
text_editor->set_executing_line(p_line);
|
||||
}
|
||||
|
@ -219,6 +219,7 @@ public:
|
||||
|
||||
void goto_line(int p_line);
|
||||
void goto_line_selection(int p_line, int p_begin, int p_end);
|
||||
void goto_line_centered(int p_line);
|
||||
void set_executing_line(int p_line);
|
||||
void clear_executing_line();
|
||||
|
||||
|
@ -306,8 +306,11 @@ void ScriptEditor::_goto_script_line(REF p_script, int p_line) {
|
||||
editor->push_item(p_script.ptr());
|
||||
|
||||
ScriptEditorBase *current = _get_current_editor();
|
||||
if (current)
|
||||
if (ScriptTextEditor *script_text_editor = Object::cast_to<ScriptTextEditor>(current)) {
|
||||
script_text_editor->goto_line_centered(p_line);
|
||||
} else if (current) {
|
||||
current->goto_line(p_line, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -487,6 +487,11 @@ void ScriptTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
|
||||
code_editor->goto_line_selection(p_line, p_begin, p_end);
|
||||
}
|
||||
|
||||
void ScriptTextEditor::goto_line_centered(int p_line) {
|
||||
|
||||
code_editor->goto_line_centered(p_line);
|
||||
}
|
||||
|
||||
void ScriptTextEditor::set_executing_line(int p_line) {
|
||||
code_editor->set_executing_line(p_line);
|
||||
}
|
||||
|
@ -201,6 +201,7 @@ public:
|
||||
|
||||
virtual void goto_line(int p_line, bool p_with_error = false);
|
||||
void goto_line_selection(int p_line, int p_begin, int p_end);
|
||||
void goto_line_centered(int p_line);
|
||||
virtual void set_executing_line(int p_line);
|
||||
virtual void clear_executing_line();
|
||||
|
||||
|
@ -6452,6 +6452,7 @@ void TextEdit::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_text"), &TextEdit::get_text);
|
||||
ClassDB::bind_method(D_METHOD("get_line", "line"), &TextEdit::get_line);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("center_viewport_to_cursor"), &TextEdit::center_viewport_to_cursor);
|
||||
ClassDB::bind_method(D_METHOD("cursor_set_column", "column", "adjust_viewport"), &TextEdit::cursor_set_column, DEFVAL(true));
|
||||
ClassDB::bind_method(D_METHOD("cursor_set_line", "line", "adjust_viewport", "can_be_hidden", "wrap_index"), &TextEdit::cursor_set_line, DEFVAL(true), DEFVAL(true), DEFVAL(0));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user