1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:47:35 +00:00

Terminal+LibVT: Add "clear including history" action (Ctrl+Shift+K) :^)

Sometimes you just want to get rid of all your scrollback history in
the terminal, and now there's a way to do that.
This commit is contained in:
Andreas Kling 2020-07-05 23:34:02 +02:00
parent e8a59ef842
commit 0c4b0c0312
5 changed files with 27 additions and 0 deletions

View file

@ -133,9 +133,15 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<Co
paste();
});
m_clear_including_history_action = GUI::Action::create("Clear including history", { Mod_Ctrl | Mod_Shift, Key_K }, [this](auto&) {
clear_including_history();
});
m_context_menu = GUI::Menu::construct();
m_context_menu->add_action(copy_action());
m_context_menu->add_action(paste_action());
m_context_menu->add_separator();
m_context_menu->add_action(clear_including_history_action());
}
TerminalWidget::~TerminalWidget()
@ -865,3 +871,8 @@ void TerminalWidget::did_change_font()
if (!size().is_empty())
relayout(size());
}
void TerminalWidget::clear_including_history()
{
m_terminal.clear_including_history();
}