From 3fd05849a20ee0ce60d4a480fa67e49a0ccc9a0b Mon Sep 17 00:00:00 2001 From: tuckerrrrrrrrrrrr Date: Mon, 10 Feb 2020 17:00:09 -0800 Subject: [PATCH] ctrl + end scrolls to the bottom of chat --- src/widgets/splits/SplitInput.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index e02a2e69a..8e4aa0fd7 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -9,6 +9,7 @@ #include "singletons/Theme.hpp" #include "util/LayoutCreator.hpp" #include "widgets/Notebook.hpp" +#include "widgets/Scrollbar.hpp" #include "widgets/dialogs/EmotePopup.hpp" #include "widgets/helper/ChannelView.hpp" #include "widgets/helper/EffectLabel.hpp" @@ -267,14 +268,21 @@ void SplitInput::installKeyPressedEvent() } else if (event->key() == Qt::Key_End) { - QTextCursor cursor = this->ui_.textEdit->textCursor(); - cursor.movePosition( - QTextCursor::End, - event->modifiers() & Qt::KeyboardModifier::ShiftModifier - ? QTextCursor::MoveMode::KeepAnchor - : QTextCursor::MoveMode::MoveAnchor); - this->ui_.textEdit->setTextCursor(cursor); - + if (event->modifiers() == Qt::ControlModifier) + { + this->split_->getChannelView().getScrollBar().scrollToBottom( + getSettings()->enableSmoothScrollingNewMessages.getValue()); + } + else + { + QTextCursor cursor = this->ui_.textEdit->textCursor(); + cursor.movePosition( + QTextCursor::End, + event->modifiers() & Qt::KeyboardModifier::ShiftModifier + ? QTextCursor::MoveMode::KeepAnchor + : QTextCursor::MoveMode::MoveAnchor); + this->ui_.textEdit->setTextCursor(cursor); + } event->accept(); } else if (event->key() == Qt::Key_H &&