summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKurt Hindenburg <[email protected]>2017-07-01 19:12:39 -0400
committerSlávek Banko <[email protected]>2021-10-11 10:15:13 +0200
commita13485e3059e968b89b09d74bc4967f4843783ff (patch)
tree2e7853aaaff03b445aad8df56535c1ff38d91e14
parentaf843540a007f7f2ad542d262d7cd10bc3ba4614 (diff)
downloadtdebase-a13485e3059e968b89b09d74bc4967f4843783ff.tar.gz
tdebase-a13485e3059e968b89b09d74bc4967f4843783ff.zip
Konsole: Correct scrollUp behavior
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 <[email protected]> (cherry picked from commit 0bb1c7eb4c2c423ebf52d199ad307e4163821a67)
-rw-r--r--konsole/konsole/TEScreen.cpp20
1 files 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)