1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 21:45:06 +00:00

HackStudio: Scroll embedded terminals to bottom upon command execution

It was kinda annoying that you had to scroll down manually every time
you started a new build while looking at some error in the scrollback.
This commit is contained in:
Andreas Kling 2020-11-10 11:47:51 +01:00
parent 9475427d5d
commit 07a2d22c33
3 changed files with 7 additions and 4 deletions

View file

@ -505,10 +505,10 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_add_terminal_action()
return GUI::Action::create("Add new Terminal", { Mod_Ctrl | Mod_Alt, Key_T }, return GUI::Action::create("Add new Terminal", { Mod_Ctrl | Mod_Alt, Key_T },
Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"), Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"),
[this](auto&) { [this](auto&) {
auto& terminal = m_action_tab_widget->add_tab<TerminalWrapper>("Terminal"); auto& terminal_wrapper = m_action_tab_widget->add_tab<TerminalWrapper>("Terminal");
reveal_action_tab(terminal); reveal_action_tab(terminal_wrapper);
update_actions(); update_actions();
terminal.terminal()->set_focus(true); terminal_wrapper.terminal().set_focus(true);
}); });
} }

View file

@ -154,6 +154,9 @@ void TerminalWrapper::run_command(const String& command)
} }
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
// (In parent process)
terminal().scroll_to_bottom();
} }
void TerminalWrapper::kill_running_command() void TerminalWrapper::kill_running_command()

View file

@ -41,7 +41,7 @@ public:
void kill_running_command(); void kill_running_command();
bool user_spawned() const { return m_user_spawned; } bool user_spawned() const { return m_user_spawned; }
TerminalWidget* terminal() { return m_terminal_widget; } TerminalWidget& terminal() { return *m_terminal_widget; }
Function<void()> on_command_exit; Function<void()> on_command_exit;