Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 08958f7

Browse files
authoredOct 27, 2017
Merge pull request #19 from fungi/master
Correct scrollUp behavior
2 parents e605ce9 + f3dab23 commit 08958f7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎lib/Screen.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -728,13 +728,18 @@ QRect Screen::lastScrolledRegion() const
728728

729729
void Screen::scrollUp(int from, int n)
730730
{
731-
if (n <= 0 || from + n > _bottomMargin) return;
731+
if (n <= 0)
732+
return;
733+
if (from > _bottomMargin)
734+
return;
735+
if (from + n > _bottomMargin)
736+
n = _bottomMargin + 1 - from;
732737

733738
_scrolledLines -= n;
734739
_lastScrolledRegion = QRect(0,_topMargin,columns-1,(_bottomMargin-_topMargin));
735740

736741
//FIXME: make sure `topMargin', `bottomMargin', `from', `n' is in bounds.
737-
moveImage(loc(0,from),loc(0,from+n),loc(columns-1,_bottomMargin));
742+
moveImage(loc(0,from),loc(0,from+n),loc(columns,_bottomMargin));
738743
clearImage(loc(0,_bottomMargin-n+1),loc(columns-1,_bottomMargin),' ');
739744
}
740745

0 commit comments

Comments
 (0)
Please sign in to comment.