1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

HackStudio: Add context option to set execution point while debugging

You can now right click in HackStudio's editor while debugging and
have the option to instantly move the current execution position to
the current line.
This commit is contained in:
FalseHonesty 2021-04-27 21:20:20 -04:00 committed by Linus Groh
parent 31c3382577
commit b0145ea529
4 changed files with 30 additions and 0 deletions

View file

@ -52,7 +52,20 @@ Editor::Editor()
auto dialog = EvaluateExpressionDialog::construct(window());
dialog->exec();
});
m_move_execution_to_line_action = GUI::Action::create("Set execution point to line", [this](auto&) {
if (!execution_position().has_value()) {
GUI::MessageBox::show(window(), "Program must be paused", "Error", GUI::MessageBox::Type::Error);
return;
}
auto success = Debugger::the().set_execution_position(currently_open_file(), cursor().line());
if (success) {
set_execution_position(cursor().line());
} else {
GUI::MessageBox::show(window(), "Failed to set execution position", "Error", GUI::MessageBox::Type::Error);
}
});
add_custom_context_menu_action(*m_evaluate_expression_action);
add_custom_context_menu_action(*m_move_execution_to_line_action);
}
Editor::~Editor()