From 0bb1c7eb4c2c423ebf52d199ad307e4163821a67 Mon Sep 17 00:00:00 2001 From: Kurt Hindenburg Date: Sat, 1 Jul 2017 19:12:39 -0400 Subject: Konsole: Correct scrollUp behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CSI S escape sequence (SU, scroll up) ignored if number of lines to scroll bigger than scrollable lines REVIEW: 130133 BUG: 379318 Taken from KDE patches and adapted to TDE. Signed-off-by: Slávek Banko --- konsole/konsole/TEScreen.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/konsole/konsole/TEScreen.cpp b/konsole/konsole/TEScreen.cpp index d3209b65c..f0ca2b176 100644 --- a/konsole/konsole/TEScreen.cpp +++ b/konsole/konsole/TEScreen.cpp @@ -825,10 +825,22 @@ void TEScreen::scrollUp(int n) void TEScreen::scrollUp(int from, int n) { - if (n <= 0 || from + n > bmargin) return; - //FIXME: make sure `tmargin', `bmargin', `from', `n' is in bounds. - moveImage(loc(0,from),loc(0,from+n),loc(columns-1,bmargin)); - clearImage(loc(0,bmargin-n+1),loc(columns-1,bmargin),' '); + if (n <= 0) + { + return; + } + if (from > bmargin) + { + return; + } + if ((from + n) > bmargin) + { + n = bmargin + 1 - from; + } + + //FIXME: make sure `tmargin', `bmargin', `from', `n' is in bounds. + moveImage(loc(0, from), loc(0, from+n), loc(columns, bmargin)); + clearImage(loc(0, bmargin-n+1), loc(columns-1, bmargin), ' '); } void TEScreen::scrollDown(int n) -- cgit v1.2.1