diff --git a/doc/base/classes.xml b/doc/base/classes.xml index b3ce0adb662..d3d8b2d9f67 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -39500,6 +39500,11 @@ + + + Emitted when a breakpoint is placed via the breakpoint gutter. + + Emitted when the cursor changes. diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 3449be1d934..46b64ce4017 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1509,6 +1509,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { int gutter=cache.style_normal->get_margin(MARGIN_LEFT); if (mb.x > gutter && mb.x <= gutter + cache.breakpoint_gutter_width + 3) { set_line_as_breakpoint(row, !is_line_set_as_breakpoint(row)); + emit_signal("breakpoint_toggled", row); return; } } @@ -4488,6 +4489,7 @@ void TextEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("cursor_changed")); ADD_SIGNAL(MethodInfo("text_changed")); ADD_SIGNAL(MethodInfo("request_completion")); + ADD_SIGNAL(MethodInfo("breakpoint_toggled", PropertyInfo( Variant::INT, "row"))); BIND_CONSTANT( MENU_CUT ); BIND_CONSTANT( MENU_COPY ); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 12cdc22ae4b..65741fd0729 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1013,6 +1013,18 @@ void ScriptEditor::swap_lines(TextEdit *tx, int line1, int line2) tx->cursor_set_line(line2); } +void ScriptEditor::_breakpoint_toggled(const int p_row) { + int selected = tab_container->get_current_tab(); + if (selected<0 || selected>=tab_container->get_child_count()) { + return; + } + + ScriptTextEditor *current = tab_container->get_child(selected)->cast_to(); + if (current) { + get_debugger()->set_breakpoint(current->get_edited_script()->get_path(),p_row+1,current->get_text_edit()->is_line_set_as_breakpoint(p_row)); + } +} + void ScriptEditor::_file_dialog_action(String p_file) { switch (file_dialog_option) { @@ -2200,6 +2212,7 @@ void ScriptEditor::edit(const Ref