Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 3cd4d2e4 authored by Kurt Hindenburg's avatar Kurt Hindenburg

Add profile option to scroll full/half height via Page Up/Down keys

The default is still half page - there is no GUI to change this;
either use konsoleprofile or change the .profile manually.

CCBUG: 280637
parent 2c686b7a
...@@ -87,6 +87,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = { ...@@ -87,6 +87,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = {
, { HistoryMode , "HistoryMode" , SCROLLING_GROUP , QVariant::Int } , { HistoryMode , "HistoryMode" , SCROLLING_GROUP , QVariant::Int }
, { HistorySize , "HistorySize" , SCROLLING_GROUP , QVariant::Int } , { HistorySize , "HistorySize" , SCROLLING_GROUP , QVariant::Int }
, { ScrollBarPosition , "ScrollBarPosition" , SCROLLING_GROUP , QVariant::Int } , { ScrollBarPosition , "ScrollBarPosition" , SCROLLING_GROUP , QVariant::Int }
, { ScrollFullPage , "ScrollFullPage" , SCROLLING_GROUP , QVariant::Bool }
// Terminal Features // Terminal Features
, { BlinkingTextEnabled , "BlinkingTextEnabled" , TERMINAL_GROUP , QVariant::Bool } , { BlinkingTextEnabled , "BlinkingTextEnabled" , TERMINAL_GROUP , QVariant::Bool }
...@@ -169,6 +170,7 @@ FallbackProfile::FallbackProfile() ...@@ -169,6 +170,7 @@ FallbackProfile::FallbackProfile()
setProperty(HistoryMode, Enum::FixedSizeHistory); setProperty(HistoryMode, Enum::FixedSizeHistory);
setProperty(HistorySize, 1000); setProperty(HistorySize, 1000);
setProperty(ScrollBarPosition, Enum::ScrollBarRight); setProperty(ScrollBarPosition, Enum::ScrollBarRight);
setProperty(ScrollFullPage, false);
setProperty(FlowControlEnabled, true); setProperty(FlowControlEnabled, true);
setProperty(BlinkingTextEnabled, true); setProperty(BlinkingTextEnabled, true);
......
...@@ -151,6 +151,10 @@ public: ...@@ -151,6 +151,10 @@ public:
* See Enum::ScrollBarPositionEnum * See Enum::ScrollBarPositionEnum
*/ */
ScrollBarPosition, ScrollBarPosition,
/** (bool) Specifies whether the PageUp/Down will scroll the full
* height or half height.
*/
ScrollFullPage,
/** (bool) Specifies whether the terminal will enable Bidirectional /** (bool) Specifies whether the terminal will enable Bidirectional
* text display * text display
*/ */
......
...@@ -211,12 +211,15 @@ int ScreenWindow::currentLine() const ...@@ -211,12 +211,15 @@ int ScreenWindow::currentLine() const
return qBound(0, _currentLine, lineCount() - windowLines()); 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) { if (mode == ScrollLines) {
scrollTo(currentLine() + amount); scrollTo(currentLine() + amount);
} else if (mode == ScrollPages) { } else if (mode == ScrollPages) {
scrollTo(currentLine() + amount * (windowLines() / 2)); if (fullPage)
scrollTo(currentLine() + amount * (windowLines()));
else
scrollTo(currentLine() + amount * (windowLines() / 2));
} }
} }
......
...@@ -201,8 +201,9 @@ public: ...@@ -201,8 +201,9 @@ public:
* @param amount The number of lines or pages ( depending on @p mode ) to scroll by. If * @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 * this number is positive, the view is scrolled down. If this number is negative, the view
* is scrolled up. * 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 * Specifies whether the window should automatically move to the bottom
......
...@@ -318,6 +318,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent) ...@@ -318,6 +318,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent)
, _autoCopySelectedText(false) , _autoCopySelectedText(false)
, _middleClickPasteMode(Enum::PasteFromX11Selection) , _middleClickPasteMode(Enum::PasteFromX11Selection)
, _scrollbarLocation(Enum::ScrollBarRight) , _scrollbarLocation(Enum::ScrollBarRight)
, _scrollFullPage(false)
, _wordCharacters(":@-./_~") , _wordCharacters(":@-./_~")
, _bellMode(Enum::NotifyBell) , _bellMode(Enum::NotifyBell)
, _allowBlinkingText(true) , _allowBlinkingText(true)
...@@ -1805,6 +1806,16 @@ void TerminalDisplay::setScroll(int cursor, int slines) ...@@ -1805,6 +1806,16 @@ void TerminalDisplay::setScroll(int cursor, int slines)
connect(_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(scrollBarPositionChanged(int))); connect(_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(scrollBarPositionChanged(int)));
} }
void TerminalDisplay::setScrollFullPage(bool fullPage)
{
_scrollFullPage = fullPage;
}
bool TerminalDisplay::scrollFullPage() const
{
return _scrollFullPage;
}
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* */ /* */
/* Mouse */ /* Mouse */
...@@ -2795,7 +2806,7 @@ void TerminalDisplay::outputSuspended(bool suspended) ...@@ -2795,7 +2806,7 @@ void TerminalDisplay::outputSuspended(bool suspended)
void TerminalDisplay::scrollScreenWindow(enum ScreenWindow::RelativeScrollMode mode, int amount) void TerminalDisplay::scrollScreenWindow(enum ScreenWindow::RelativeScrollMode mode, int amount)
{ {
_screenWindow->scrollBy(mode, amount); _screenWindow->scrollBy(mode, amount, _scrollFullPage);
_screenWindow->setTrackOutput(_screenWindow->atEndOfOutput()); _screenWindow->setTrackOutput(_screenWindow->atEndOfOutput());
updateLineProperties(); updateLineProperties();
updateImage(); updateImage();
......
...@@ -105,6 +105,9 @@ public: ...@@ -105,6 +105,9 @@ public:
*/ */
void setScroll(int cursor, int lines); 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, * 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 * the text is passed through each filter in the chain. Each filter can define
...@@ -801,6 +804,7 @@ private: ...@@ -801,6 +804,7 @@ private:
QScrollBar* _scrollBar; QScrollBar* _scrollBar;
Enum::ScrollBarPositionEnum _scrollbarLocation; Enum::ScrollBarPositionEnum _scrollbarLocation;
bool _scrollFullPage;
QString _wordCharacters; QString _wordCharacters;
int _bellMode; int _bellMode;
......
...@@ -791,6 +791,9 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr ...@@ -791,6 +791,9 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
else if (scrollBarPosition == Enum::ScrollBarHidden) else if (scrollBarPosition == Enum::ScrollBarHidden)
view->setScrollBarPosition(Enum::ScrollBarHidden); view->setScrollBarPosition(Enum::ScrollBarHidden);
bool scrollFullPage = profile->property<bool>(Profile::ScrollFullPage);
view->setScrollFullPage(scrollFullPage);
// show hint about terminal size after resizing // show hint about terminal size after resizing
view->setShowTerminalSizeHint(profile->showTerminalSizeHint()); view->setShowTerminalSizeHint(profile->showTerminalSizeHint());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment