mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:18:12 +00:00
Terminal: Allow scrolling through terminal history with the mouse wheel
Fixes #470.
This commit is contained in:
parent
dc3c6be6f2
commit
c106ec4719
2 changed files with 16 additions and 0 deletions
|
@ -407,6 +407,19 @@ void TerminalWidget::mouseup_event(GMouseEvent& event)
|
|||
GClipboard::the().set_data(selected_text());
|
||||
}
|
||||
|
||||
void TerminalWidget::mousewheel_event(GMouseEvent& event)
|
||||
{
|
||||
if (!is_scrollable())
|
||||
return;
|
||||
m_scrollbar->set_value(m_scrollbar->value() + event.wheel_delta());
|
||||
GFrame::mousewheel_event(event);
|
||||
}
|
||||
|
||||
bool TerminalWidget::is_scrollable() const
|
||||
{
|
||||
return m_scrollbar->is_scrollable();
|
||||
}
|
||||
|
||||
String TerminalWidget::selected_text() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
|
|
@ -39,6 +39,8 @@ public:
|
|||
VT::Position normalized_selection_start() const;
|
||||
VT::Position normalized_selection_end() const;
|
||||
|
||||
bool is_scrollable() const;
|
||||
|
||||
private:
|
||||
// ^GWidget
|
||||
virtual void event(CEvent&) override;
|
||||
|
@ -48,6 +50,7 @@ private:
|
|||
virtual void mousedown_event(GMouseEvent&) override;
|
||||
virtual void mousemove_event(GMouseEvent&) override;
|
||||
virtual void mouseup_event(GMouseEvent&) override;
|
||||
virtual void mousewheel_event(GMouseEvent&) override;
|
||||
|
||||
// ^TerminalClient
|
||||
virtual void beep() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue