From 0956611a06289d983d99d66ee22761e5cc71aa2e Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Sun, 20 May 2007 23:35:51 +0000 Subject: [PATCH] Update output tracking state of screen window when scrolling using Shift+Page/Arrow keys svn path=/trunk/KDE/kdebase/apps/konsole/; revision=666825 --- src/ScreenWindow.cpp | 5 +++++ src/ScreenWindow.h | 6 ++++++ src/TerminalDisplay.cpp | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/ScreenWindow.cpp b/src/ScreenWindow.cpp index da185d7c3..05d3c3bfc 100644 --- a/src/ScreenWindow.cpp +++ b/src/ScreenWindow.cpp @@ -140,6 +140,11 @@ void ScreenWindow::scrollBy( RelativeScrollMode mode , int amount ) } } +bool ScreenWindow::atEndOfOutput() const +{ + return _currentLine >= (lineCount()-windowLines()); +} + void ScreenWindow::scrollTo( int line ) { if ( line < 0 ) diff --git a/src/ScreenWindow.h b/src/ScreenWindow.h index 54fe0e840..30a51a665 100644 --- a/src/ScreenWindow.h +++ b/src/ScreenWindow.h @@ -137,6 +137,12 @@ public: /** Returns the index of the line which is currently at the top of this window */ int currentLine() const; + /** + * Convenience method. Returns true if the window is currently at the bottom + * of the screen. + */ + bool atEndOfOutput() const; + /** Scrolls the window so that @p line is at the top of the window */ void scrollTo( int line ); diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index fe411ef71..4d5caa275 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -2246,6 +2246,8 @@ void TerminalDisplay::keyPressEvent( QKeyEvent* event ) if ( update ) { + _screenWindow->setTrackOutput( _screenWindow->atEndOfOutput() ); + updateLineProperties(); updateImage(); }