summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-11-29 18:19:45 +0330
committerAndreas Kling <kling@serenityos.org>2020-11-29 20:32:45 +0100
commit1279d2256c5ca871bc7d15e13792f882e34ff3f1 (patch)
tree6f153fd5efdbc7134ac03461a04bb2cb7e01ea5e
parent5c8b48053e047a4254929b95289d69a9bf578bd2 (diff)
downloadserenity-1279d2256c5ca871bc7d15e13792f882e34ff3f1.zip
Terminal: Allow the user to configure the maximum history size
Closes #4238.
-rw-r--r--Applications/Terminal/main.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp
index 4f4f6d5ff8..f47a7eaf07 100644
--- a/Applications/Terminal/main.cpp
+++ b/Applications/Terminal/main.cpp
@@ -157,7 +157,7 @@ static RefPtr<GUI::Window> create_settings_window(TerminalWidget& terminal)
auto window = GUI::Window::construct();
window->set_title("Terminal Settings");
window->set_resizable(false);
- window->resize(200, 185);
+ window->resize(200, 230);
window->set_modal(true);
auto& settings = window->set_main_widget<GUI::Widget>();
@@ -207,6 +207,19 @@ static RefPtr<GUI::Window> create_settings_window(TerminalWidget& terminal)
terminal.set_scroll_length(value);
};
+ auto& history_size_spinbox_container = settings.add<GUI::GroupBox>("Maximum scrollback history lines");
+ history_size_spinbox_container.set_layout<GUI::VerticalBoxLayout>();
+ history_size_spinbox_container.layout()->set_margins({ 6, 16, 6, 6 });
+ history_size_spinbox_container.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
+ history_size_spinbox_container.set_preferred_size(100, 46);
+
+ auto& history_size_spinbox = history_size_spinbox_container.add<GUI::SpinBox>();
+ history_size_spinbox.set_range(0, 40960);
+ history_size_spinbox.set_value(terminal.max_history_size());
+ history_size_spinbox.on_change = [&terminal](int value) {
+ terminal.set_max_history_size(value);
+ };
+
return window;
}
@@ -292,6 +305,9 @@ int main(int argc, char** argv)
terminal.set_opacity(new_opacity);
window->set_has_alpha_channel(new_opacity < 255);
+ auto new_scrollback_size = config->read_num_entry("Terminal", "MaxHistorySize", terminal.max_history_size());
+ terminal.set_max_history_size(new_scrollback_size);
+
auto menubar = GUI::MenuBar::construct();
auto& app_menu = menubar->add_menu("Terminal");