diff options
author | Andreas Kling <kling@serenityos.org> | 2020-11-10 11:47:19 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-10 11:55:12 +0100 |
commit | 9475427d5def387dc56d6d70c729aaaf0a31fa34 (patch) | |
tree | 9c2e712152c06b4f2f96c05106d5f4a7d2816274 /Libraries | |
parent | eac0344ef08cb249a90a0495b24235ea8bfb1315 (diff) | |
download | serenity-9475427d5def387dc56d6d70c729aaaf0a31fa34.zip |
LibVT: Add TerminalWidget::scroll_to_bottom() API
(And use this internally when scrolling to bottom on non-modifier
keydown events.)
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibVT/TerminalWidget.cpp | 7 | ||||
-rw-r--r-- | Libraries/LibVT/TerminalWidget.h | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp index 948c2f402c..ae8a42062c 100644 --- a/Libraries/LibVT/TerminalWidget.cpp +++ b/Libraries/LibVT/TerminalWidget.cpp @@ -243,7 +243,7 @@ void TerminalWidget::keydown_event(GUI::KeyEvent& event) m_terminal.handle_key_press(event.key(), event.code_point(), event.modifiers()); if (event.key() != Key_Control && event.key() != Key_Alt && event.key() != Key_LeftShift && event.key() != Key_RightShift && event.key() != Key_Logo) - m_scrollbar->set_value(m_scrollbar->max()); + scroll_to_bottom(); } void TerminalWidget::keyup_event(GUI::KeyEvent& event) @@ -885,3 +885,8 @@ void TerminalWidget::clear_including_history() { m_terminal.clear_including_history(); } + +void TerminalWidget::scroll_to_bottom() +{ + m_scrollbar->set_value(m_scrollbar->max()); +} diff --git a/Libraries/LibVT/TerminalWidget.h b/Libraries/LibVT/TerminalWidget.h index 3f83c50229..3d6ce15f6e 100644 --- a/Libraries/LibVT/TerminalWidget.h +++ b/Libraries/LibVT/TerminalWidget.h @@ -73,6 +73,8 @@ public: VT::Position normalized_selection_start() const; VT::Position normalized_selection_end() const; + void scroll_to_bottom(); + bool is_scrollable() const; int scroll_length() const; void set_scroll_length(int); |