Added, goto next and previous breakpoint and remove all, issue 1690
(cherry picked from commit daf0ed646f
)
This commit is contained in:
parent
178168aa8a
commit
7029c96221
|
@ -1388,6 +1388,61 @@ void ScriptEditor::_menu_option(int p_option) {
|
||||||
current->get_text_edit()->set_line_as_breakpoint(line,dobreak);
|
current->get_text_edit()->set_line_as_breakpoint(line,dobreak);
|
||||||
get_debugger()->set_breakpoint(current->get_edited_script()->get_path(),line+1,dobreak);
|
get_debugger()->set_breakpoint(current->get_edited_script()->get_path(),line+1,dobreak);
|
||||||
} break;
|
} break;
|
||||||
|
case DEBUG_REMOVE_ALL_BREAKPOINTS: {
|
||||||
|
List<int> bpoints;
|
||||||
|
current->get_text_edit()->get_breakpoints(&bpoints);
|
||||||
|
|
||||||
|
for(List<int>::Element *E=bpoints.front();E;E=E->next()) {
|
||||||
|
int line = E->get();
|
||||||
|
bool dobreak = !current->get_text_edit()->is_line_set_as_breakpoint(line);
|
||||||
|
current->get_text_edit()->set_line_as_breakpoint(line,dobreak);
|
||||||
|
get_debugger()->set_breakpoint(current->get_edited_script()->get_path(),line+1,dobreak);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case DEBUG_GOTO_NEXT_BREAKPOINT: {
|
||||||
|
List<int> bpoints;
|
||||||
|
current->get_text_edit()->get_breakpoints(&bpoints);
|
||||||
|
if (bpoints.size() <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int line=current->get_text_edit()->cursor_get_line();
|
||||||
|
// wrap around
|
||||||
|
if (line >= bpoints[bpoints.size() - 1]) {
|
||||||
|
current->get_text_edit()->cursor_set_line(bpoints[0]);
|
||||||
|
} else {
|
||||||
|
for(List<int>::Element *E=bpoints.front();E;E=E->next()) {
|
||||||
|
int bline = E->get();
|
||||||
|
if (bline > line) {
|
||||||
|
current->get_text_edit()->cursor_set_line(bline);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case DEBUG_GOTO_PREV_BREAKPOINT: {
|
||||||
|
List<int> bpoints;
|
||||||
|
current->get_text_edit()->get_breakpoints(&bpoints);
|
||||||
|
if (bpoints.size() <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int line=current->get_text_edit()->cursor_get_line();
|
||||||
|
// wrap around
|
||||||
|
if (line <= bpoints[0]) {
|
||||||
|
current->get_text_edit()->cursor_set_line(bpoints[bpoints.size() - 1]);
|
||||||
|
} else {
|
||||||
|
for(List<int>::Element *E=bpoints.back();E;E=E->prev()) {
|
||||||
|
int bline = E->get();
|
||||||
|
if (bline < line) {
|
||||||
|
current->get_text_edit()->cursor_set_line(bline);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} break;
|
||||||
case DEBUG_NEXT: {
|
case DEBUG_NEXT: {
|
||||||
|
|
||||||
if (debugger)
|
if (debugger)
|
||||||
|
@ -2491,6 +2546,9 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
|
||||||
menu_hb->add_child(debug_menu);
|
menu_hb->add_child(debug_menu);
|
||||||
debug_menu->set_text("Debug");
|
debug_menu->set_text("Debug");
|
||||||
debug_menu->get_popup()->add_item("Toggle Breakpoint",DEBUG_TOGGLE_BREAKPOINT,KEY_F9);
|
debug_menu->get_popup()->add_item("Toggle Breakpoint",DEBUG_TOGGLE_BREAKPOINT,KEY_F9);
|
||||||
|
debug_menu->get_popup()->add_item("Remove All Breakpoints", DEBUG_REMOVE_ALL_BREAKPOINTS, KEY_MASK_CTRL|KEY_MASK_SHIFT|KEY_F9);
|
||||||
|
debug_menu->get_popup()->add_item("Goto Next Breakpoint", DEBUG_GOTO_NEXT_BREAKPOINT, KEY_MASK_CTRL|KEY_PERIOD);
|
||||||
|
debug_menu->get_popup()->add_item("Goto Previous Breakpoint", DEBUG_GOTO_PREV_BREAKPOINT, KEY_MASK_CTRL|KEY_COMMA);
|
||||||
debug_menu->get_popup()->add_separator();
|
debug_menu->get_popup()->add_separator();
|
||||||
debug_menu->get_popup()->add_item("Step Over",DEBUG_NEXT,KEY_F10);
|
debug_menu->get_popup()->add_item("Step Over",DEBUG_NEXT,KEY_F10);
|
||||||
debug_menu->get_popup()->add_item("Step Into",DEBUG_STEP,KEY_F11);
|
debug_menu->get_popup()->add_item("Step Into",DEBUG_STEP,KEY_F11);
|
||||||
|
|
|
@ -147,6 +147,9 @@ class ScriptEditor : public VBoxContainer {
|
||||||
SEARCH_CLASSES,
|
SEARCH_CLASSES,
|
||||||
SEARCH_WEBSITE,
|
SEARCH_WEBSITE,
|
||||||
DEBUG_TOGGLE_BREAKPOINT,
|
DEBUG_TOGGLE_BREAKPOINT,
|
||||||
|
DEBUG_REMOVE_ALL_BREAKPOINTS,
|
||||||
|
DEBUG_GOTO_NEXT_BREAKPOINT,
|
||||||
|
DEBUG_GOTO_PREV_BREAKPOINT,
|
||||||
DEBUG_NEXT,
|
DEBUG_NEXT,
|
||||||
DEBUG_STEP,
|
DEBUG_STEP,
|
||||||
DEBUG_BREAK,
|
DEBUG_BREAK,
|
||||||
|
|
Loading…
Reference in New Issue