diff --git a/src/Profile.cpp b/src/Profile.cpp index 4995d904f..14946ce69 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -87,6 +87,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = { , { HistoryMode , "HistoryMode" , SCROLLING_GROUP , QVariant::Int } , { HistorySize , "HistorySize" , SCROLLING_GROUP , QVariant::Int } , { ScrollBarPosition , "ScrollBarPosition" , SCROLLING_GROUP , QVariant::Int } + , { ScrollFullPage , "ScrollFullPage" , SCROLLING_GROUP , QVariant::Bool } // Terminal Features , { BlinkingTextEnabled , "BlinkingTextEnabled" , TERMINAL_GROUP , QVariant::Bool } @@ -169,6 +170,7 @@ FallbackProfile::FallbackProfile() setProperty(HistoryMode, Enum::FixedSizeHistory); setProperty(HistorySize, 1000); setProperty(ScrollBarPosition, Enum::ScrollBarRight); + setProperty(ScrollFullPage, false); setProperty(FlowControlEnabled, true); setProperty(BlinkingTextEnabled, true); diff --git a/src/Profile.h b/src/Profile.h index fea0d73a7..596f78acc 100644 --- a/src/Profile.h +++ b/src/Profile.h @@ -151,6 +151,10 @@ public: * See Enum::ScrollBarPositionEnum */ ScrollBarPosition, + /** (bool) Specifies whether the PageUp/Down will scroll the full + * height or half height. + */ + ScrollFullPage, /** (bool) Specifies whether the terminal will enable Bidirectional * text display */ diff --git a/src/ScreenWindow.cpp b/src/ScreenWindow.cpp index bafc6a044..daa025c5c 100644 --- a/src/ScreenWindow.cpp +++ b/src/ScreenWindow.cpp @@ -211,12 +211,15 @@ int ScreenWindow::currentLine() const return qBound(0, _currentLine, lineCount() - windowLines()); } -void ScreenWindow::scrollBy(RelativeScrollMode mode , int amount) +void ScreenWindow::scrollBy(RelativeScrollMode mode, int amount, bool fullPage) { if (mode == ScrollLines) { scrollTo(currentLine() + amount); } else if (mode == ScrollPages) { - scrollTo(currentLine() + amount * (windowLines() / 2)); + if (fullPage) + scrollTo(currentLine() + amount * (windowLines())); + else + scrollTo(currentLine() + amount * (windowLines() / 2)); } } diff --git a/src/ScreenWindow.h b/src/ScreenWindow.h index 1aa938a0a..89fe7bed7 100644 --- a/src/ScreenWindow.h +++ b/src/ScreenWindow.h @@ -201,8 +201,9 @@ public: * @param amount The number of lines or pages ( depending on @p mode ) to scroll by. If * this number is positive, the view is scrolled down. If this number is negative, the view * is scrolled up. + * @param fullPage Specifies whether to scroll by full page or half page. */ - void scrollBy(RelativeScrollMode mode , int amount); + void scrollBy(RelativeScrollMode mode, int amount, bool fullPage); /** * Specifies whether the window should automatically move to the bottom diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index 91856f534..8016c1eab 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -318,6 +318,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent) , _autoCopySelectedText(false) , _middleClickPasteMode(Enum::PasteFromX11Selection) , _scrollbarLocation(Enum::ScrollBarRight) + , _scrollFullPage(false) , _wordCharacters(":@-./_~") , _bellMode(Enum::NotifyBell) , _allowBlinkingText(true) @@ -1805,6 +1806,16 @@ void TerminalDisplay::setScroll(int cursor, int slines) connect(_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(scrollBarPositionChanged(int))); } +void TerminalDisplay::setScrollFullPage(bool fullPage) +{ + _scrollFullPage = fullPage; +} + +bool TerminalDisplay::scrollFullPage() const +{ + return _scrollFullPage; +} + /* ------------------------------------------------------------------------- */ /* */ /* Mouse */ @@ -2795,7 +2806,7 @@ void TerminalDisplay::outputSuspended(bool suspended) void TerminalDisplay::scrollScreenWindow(enum ScreenWindow::RelativeScrollMode mode, int amount) { - _screenWindow->scrollBy(mode, amount); + _screenWindow->scrollBy(mode, amount, _scrollFullPage); _screenWindow->setTrackOutput(_screenWindow->atEndOfOutput()); updateLineProperties(); updateImage(); diff --git a/src/TerminalDisplay.h b/src/TerminalDisplay.h index 1747f1b68..46058beb2 100644 --- a/src/TerminalDisplay.h +++ b/src/TerminalDisplay.h @@ -105,6 +105,9 @@ public: */ void setScroll(int cursor, int lines); + void setScrollFullPage(bool fullPage); + bool scrollFullPage() const; + /** * Returns the display's filter chain. When the image for the display is updated, * the text is passed through each filter in the chain. Each filter can define @@ -801,6 +804,7 @@ private: QScrollBar* _scrollBar; Enum::ScrollBarPositionEnum _scrollbarLocation; + bool _scrollFullPage; QString _wordCharacters; int _bellMode; diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index 4071b8bc5..355365aa5 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -791,6 +791,9 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr else if (scrollBarPosition == Enum::ScrollBarHidden) view->setScrollBarPosition(Enum::ScrollBarHidden); + bool scrollFullPage = profile->property(Profile::ScrollFullPage); + view->setScrollFullPage(scrollFullPage); + // show hint about terminal size after resizing view->setShowTerminalSizeHint(profile->showTerminalSizeHint());