summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas CHOLLET <lucas.chollet@free.fr>2022-02-28 10:13:09 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-14 23:43:36 +0100
commit6f29ccaa5a029b35eafb9860952ea9cdfab0edb7 (patch)
tree34988bd1f3836885d21f780b6638c6cb281aa19e
parent1a739b5d6ea4257e8e2b607e43152047016346e4 (diff)
downloadserenity-6f29ccaa5a029b35eafb9860952ea9cdfab0edb7.zip
HackStudio: Remove Terminal widget when the bound shell process dies
This feature allows the terminal widget to be automatically closed when typing `exit` inside the shell.
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index 69bce9002e..10ca01ac54 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -820,6 +820,11 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_add_terminal_action()
Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/add-terminal.png").release_value_but_fixme_should_propagate_errors(),
[this](auto&) {
auto& terminal_wrapper = m_action_tab_widget->add_tab<TerminalWrapper>("Terminal");
+ terminal_wrapper.on_command_exit = [&]() {
+ deferred_invoke([this]() {
+ m_action_tab_widget->remove_tab(*m_action_tab_widget->active_widget());
+ });
+ };
reveal_action_tab(terminal_wrapper);
update_actions();
terminal_wrapper.terminal().set_focus(true);